[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [bluetooth-dev] _IOW(BT_IOC_MAGIC, 0x58, unsigned char[8]) ..!



Hello,

The byteorder shall be reversed in your example if you are running on a
little endian system (i.e. Intel or Axis devboard). An ioctl like this
shall however work in both cases so it shall probably be changed to 
parse each byte in a specified order and not cast the whole value
directly. There is no way at the moment to find out the HCI handle
for a connection from userspace, so you must implement the IOCTL
yourself. As you know the BD-address for your connection you can
send it to the driver and then use get_con(bd_addr, ANY_STATE) to
find the connection and return con->con_hdl). Another way is to
change the SUPERVISIONTO-ioctl to use the BD-address instead of
a hci-handle, which probably is a lot more useful! :). If you
don't want to implement this the only option left is to read
and parse the /proc/bt_internal file to find the HCI-handle.

Regards,
Anders



> -----Original Message-----
> From: axis [mailto:axis2list@xxxxxxx.com]
> Sent: den 29 oktober 2003 17:01
> To: Bluetooth-dev
> Cc: pkj@xxxxxxx.com
> Subject: RE: [bluetooth-dev] _IOW(BT_IOC_MAGIC, 0x58, 
> unsigned char[8])
> ..!
> 
> 
> Sir,
>      But how can we retrive HCI connection handle.Is
> this HCI handle accessable at user level?Is there any
> function which retrives this handle.And for 20 second
> timeout can I use the following:Is my byte ordering
> correct ?
>   unsigned char link_to[8];
>   unsigned short t = 20;
>   link_to[4] = 0;
>   link_to[5] = 0;
>   link_to[6] = 0;
>   link_to[7] = (unsigned char)(t);
>       If you can give me some code snippet regarding
> this,it will be of great help to me.Hope to hear from
> you regarding this,
> Thank you.
>    
> --- Anders Torbjorn Johansson
> <anders.t.johansson@xxxxxxx.com> wrote:
> > Hi,
> > 
> > You need to specify the hci-handle for the
> > connection in the call to 
> > HCIWRITELINKSUPERVISIONTO. So the data sent shall
> > be:
> > 
> > | HCI handle 4 bytes | Timeout 4 bytes |
> > 
> > And, as Peter said, the API really sucks!! ;).
> > 
> > Regards,
> > Anders
> > 
> > > -----Original Message-----
> > > From: axis [mailto:axis2list@xxxxxxx.com]
> > > Sent: den 29 oktober 2003 12:23
> > > To: Bluetooth-dev
> > > Subject: [bluetooth-dev] _IOW(BT_IOC_MAGIC, 0x58,
> > unsigned 
> > > char[8]) ..!
> > > 
> > > 
> > > Sir,
> > >     I tried the format you have told,but still Iam
> > not
> > > able to set the link supervision timeout.My dmesg
> > on
> > > BT dev board shows the following error even if the
> > > device is connected:
> > > BT SYS: ERROR: process_return_param:    
> > > WRITE_LINK_SUPERVISION_TO: No Connection
> > >     The following are the macro for this parameter
> > and
> > > the function bt_write_link_supervision_to.Could
> > you
> > > please tell me how can I use this function
> > correctly..
> > >     Can I define my timeout as u_int32_t timeout =
> > 20
> > > in this case??
> > > 
> > > #define HCIWRITELINKSUPERVISIONTO
> > _IOW(BT_IOC_MAGIC,
> > > 0x58, unsigned char[8])
> > > 
> > > void
> > > bt_write_link_supervision_to(int bt_cfd, unsigned
> > > char* link_to)
> > > {
> > > #ifndef BTD_USERSTACK
> > >   if (ioctl(bt_cfd, HCIWRITELINKSUPERVISIONTO,
> > > link_to) < 0)
> > >   {
> > >     perror(__FUNCTION__);
> > >   }
> > > #else
> > >   fprintf(stderr, __FUNCTION__ ": Not yet
> > > implemented...\n");
> > > #endif
> > > }
> > >          The following is my dmesg...
> > >        
> > > bd (6):
> > > 0x00 0xde 0x17 0xc6 0x10 0x00
> > > l2ca_connect_req: wait baseband, sleep on wq
> > > 0xc03d2c33
> > >  
> > > hci_link_key_request_negative_reply:  BD_addr (6):
> > > 0x00 0xde 0x17 0xc6 0x10 0x00
> > > hci_link_key_request_negative_reply: Returned from
> > > send_secblock
> > >  
> > > hci_pin_code_request_reply: New pin is
> > >  (4):
> > > 0x30 0x30 0x30 0x30
> > >  
> > > hci_pin_code_request_reply:  BD_addr (6):
> > > 0x00 0xde 0x17 0xc6 0x10 0x00
> > >  
> > > hci_pin_code_request_reply:  pin (4):
> > > 0x30 0x30 0x30 0x30
> > > lp_connect_cfm (pos), wake up wq 0xc03d2c33
> > > l2ca_connect_req: wait baseband, woke up !
> > > l2ca_connect_req: wait rsp, sleep on wq 0xc03d2c33
> > > rfcomm_connect_pnd : reason 2
> > > l2cap con rsp, wake up wq 0xc03d2c33
> > >  
> > > l2cap options:  (0):
> > > l2ca_connect_req: wait rsp, woke up !
> > > BT SYS: ERROR: process_return_param:
> > > WRITE_LINK_SUPERVISION_TO: No Connection
> > >  
> > > 
> > > 
> > > --- Peter Kjellerstedt
> > <peter.kjellerstedt@xxxxxxx.com> 
> > > > 
> > > > Call it as:
> > > > 
> > > > 	u_int32_t timeout = 20;
> > > > 	bt_write_link_supervision_to(bt_cfd, (unsigned
> > > > char*)&timeout);
> > > > 
> > > > (And yes, the API for those functions sucks.)
> > > > 
> > > > //Peter
> > > 
> > > 
> > > __________________________________
> > > Do you Yahoo!?
> > > Exclusive Video Premiere - Britney Spears
> > > http://launch.yahoo.com/promos/britneyspears/
> > > -
> > > To unsubscribe from this list: send the line
> > "unsubscribe 
> > > bluetooth-dev" in
> > > the body of a message to majordomo@xxxxxxx.com
> > > 
> > 
> > -
> > To unsubscribe from this list: send the line
> > "unsubscribe bluetooth-dev" in
> > the body of a message to majordomo@xxxxxxx.com
> 
> 
> __________________________________
> Do you Yahoo!?
> Exclusive Video Premiere - Britney Spears
> http://launch.yahoo.com/promos/britneyspears/
> -
> To unsubscribe from this list: send the line "unsubscribe 
> bluetooth-dev" in
> the body of a message to majordomo@xxxxxxx.com
> 

-
To unsubscribe from this list: send the line "unsubscribe bluetooth-dev" in
the body of a message to majordomo@xxxxxxx.com