[ug-bosug] Bluetooth Stack in userspace

Amit Sharma Amit.Sharma at Sun.COM
Mon Mar 31 06:46:05 PDT 2008


Anand,

.....
 > hci_inquiry(hd,req,resp);  // inquire for devices
		^---- what do these three arguments mean, and if any of them gets data 
as a result of the hci_inquiry, have you made sure to have allocated 
sufficient memory/buffer for it ?

Pasting some of your code above this call to hci_inquiry and also the 
definition/proto of hci_inquiry would help in finding the problem.


 > malloc(sizeof(struct hci_evt));
^---- I am not sure how this is helping because you are not collecting 
the return value of malloc into a buffer or any other variable.


Anand Bheemarajaiah wrote:
> Hello all,
> 
> I am currently building the bluetooth stack support in solaris for usb bluetooth dongles using the libusb api as a part of my undergraduate final year project.
> 
> I have completed the hci-usb layer, hci layer, l2cap layer, sdp layer. I am currently doing the rfcomm layer.
> 
> My query is with the code, it has started to behave in an unpredictable manner,
> 
> for example,
> 
> In the main function i am first inquiring for devices, then extracting their human readable names, then connecting to them and going on up the various layers of the bluetooth stack.
> 
> here in the code, main function looks something like this,
> 
> .....
> hci_inquiry(hd,req,resp);  // inquire for devices
> print_inq(resp);        // extracts the human readable names of devices discovered
> ....
> 
> 
> This code started crashing within the print_inq function after some time, now if i embed a malloc in between the two calls it works, 
> 
> .....
> hci_inquiry(hd,req,resp);  // inquire for devices
> malloc(sizeof(struct hci_evt)); 
> // hci_evt is the structure holding info of incoming event pkts.
> print_inq(resp);        // extracts the human readable names of devices discovered
> ....
> 
> 
> can you tell why it is happening so.... and the runtime error is
> 
> sigsegv with mapper code ... - it actually shows the callstack to be at realfree.
> 
> i am sure it is not running out of memory because other commands and memory allocations work just fine.
> 
> Any help would be great because i believe this is a stupid error and don't want to waste too much time on this.
> 
> regards,
> Anand B
>  
>  
> This message posted from opensolaris.org
> _______________________________________________
> ug-bosug mailing list
> List-Unsubscribe: mailto:ug-bosug-unsubscribe at opensolaris.org
> List-Owner: mailto:ug-bosug-owner at opensolaris.org
> List-Archives: http://www.opensolaris.org/jive/forum.jspa?forumID=54


-- 
Amit Sharma
Lustre Engineering
Sun Microsystems, Bangalore.


More information about the ug-bosug mailing list