Subject: Re: btconfig: SIOCSBTFLAGS: Resource temporarily unavailable
To: Iain Hibbert <plunky@rya-online.net>
From: Berndt Josef Wulf <wulf@ping.net.au>
List: tech-kern
Date: 07/16/2006 19:55:53
--nextPart1202516.iTN9MuebEW
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

On Sunday 16 July 2006 19:34, Iain Hibbert wrote:
> On Sun, 16 Jul 2006, Berndt Josef Wulf wrote:
> > However, your patch seems to get us a step further see below:
> > : {9} btconfig ubt0 up
> >
> > btconfig: SIOCSBTFLAGS: Resource temporarily unavailable
> > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> > Jul 16 18:37:28  /netbsd: hci_usrreq: ATTACH
> > Jul 16 18:37:28  /netbsd: hci_usrreq: CONTROL
> > Jul 16 18:37:28  /netbsd: hci_ioctl: cmd 0xc0386205
> > Jul 16 18:37:28  /netbsd: hci_usrreq: CONTROL
> > Jul 16 18:37:28  /netbsd: hci_ioctl: cmd 0xc0386208
> > Jul 16 18:37:28  /netbsd: ubt_enable: sc=3D0xc1f89400
> > Jul 16 18:37:28  /netbsd: hci_send_cmd: (ubt0) opcode (004|0009)
> > Jul 16 18:37:28  /netbsd: hci_send_cmd: (ubt0) opcode (004|0005)
> > Jul 16 18:37:28  /netbsd: hci_send_cmd: (ubt0) opcode (004|0003)
> > Jul 16 18:37:28  /netbsd: hci_event: (ubt0) event COMMAND COMPLETE
> > Jul 16 18:37:28  /netbsd: hci_event_command_compl: (ubt0) opcode
> > (004|0009) num_cmd_pkts =3D 1
> > Jul 16 18:37:29  /netbsd: ubt_disable: sc=3D0xc1f89400
> > Jul 16 18:37:29  /netbsd: ubt_abortdealloc: sc=3D0xc1f89400
> > Jul 16 18:37:29  /netbsd: ubt_recv_acl_complete: status=3DCANCELLED (6)
> > Jul 16 18:37:29  /netbsd: hci_usrreq: DETACH
> >
> > we are getting there....  :-)
>
> Hm, but now that says to me something different, that the first command
> only is succeeding and after that there is a blockage (when the three
> commands are sent, the first will go to the device but the others will be
> queued until the COMMAND_COMPLETE packet is received and num_cmd_pkts is
> updated.)  I can't see any race condition in that, so I'm going back to
> the thought that the problem is in the USB code..
>
> can you increase the debug level and try the 'btconfig ubt0 up' again
> please?
>
> sysctl -w hw.ubt_debug=3D15
> sysctl -w net.bluetooth.debug=3D10
>
> should show where it is getting lost..


btconfig:
ubt0: bdaddr 00:16:41:57:68:6a flags 0xc0<INIT_BUFFER_SIZE,INIT_FEATURES>
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
Jul 16 19:45:29  /netbsd: hci_usrreq: ATTACH
Jul 16 19:45:29  /netbsd: hci_usrreq: CONTROL
Jul 16 19:45:29  /netbsd: hci_ioctl: cmd 0xc0386207
Jul 16 19:45:29  /netbsd: hci_usrreq: CONTROL
Jul 16 19:45:29  /netbsd: hci_ioctl: cmd 0xc0386207
Jul 16 19:45:29  /netbsd: hci_usrreq: DETACH

btconfig ubt0:
ubt0: bdaddr 00:16:41:57:68:6a flags 0xc0<INIT_BUFFER_SIZE,INIT_FEATURES>
        num_cmd =3D 0
        num_acl =3D 0, acl_mtu =3D 0
        num_sco =3D 0, sco_mtu =3D 0
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
Jul 16 19:46:44  /netbsd: hci_usrreq: ATTACH
Jul 16 19:46:44  /netbsd: hci_usrreq: CONTROL
Jul 16 19:46:44  /netbsd: hci_ioctl: cmd 0xc0386205
Jul 16 19:46:44  /netbsd: hci_usrreq: DETACH

btconfig ubt0 up:
btconfig: SIOCSBTFLAGS: Resource temporarily unavailable
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
Jul 16 19:48:39  /netbsd: hci_usrreq: ATTACH
Jul 16 19:48:39  /netbsd: hci_usrreq: CONTROL
Jul 16 19:48:39  /netbsd: hci_ioctl: cmd 0xc0386205
Jul 16 19:48:39  /netbsd: hci_usrreq: CONTROL
Jul 16 19:48:39  /netbsd: hci_ioctl: cmd 0xc0386208
Jul 16 19:48:39  /netbsd: ubt_enable: sc=3D0xc1f89400
Jul 16 19:48:39  /netbsd: hci_send_cmd: (ubt0) opcode (004|0009)
Jul 16 19:48:39  /netbsd: hci_send_cmd: (ubt0) opcode (004|0005)
Jul 16 19:48:39  /netbsd: hci_send_cmd: (ubt0) opcode (004|0003)
Jul 16 19:48:39  /netbsd: hci_event: (ubt0) event COMMAND COMPLETE
Jul 16 19:48:39  /netbsd: hci_event_command_compl: (ubt0) opcode (004|0009)=
=20
num_cmd_pkts =3D 1
Jul 16 19:48:40  /netbsd: ubt_disable: sc=3D0xc1f89400
Jul 16 19:48:40  /netbsd: ubt_abortdealloc: sc=3D0xc1f89400
Jul 16 19:48:40  /netbsd: ubt_recv_acl_complete: status=3DCANCELLED (6)
Jul 16 19:48:40  /netbsd: hci_usrreq: DETACH

same as before but hcidump now shows:
< HCI Command: Read BD ADDR(0x04|0x0009) plen 0
> HCI Event: Command Complete(0x0e) plen 10
< HCI Command: Read Local Supported Features(0x04|0x0003) plen 0

no other output from hcidump with other commands

I then increased the debug level for net.bluetooth.debug =3D 15 and now get=
 a=20
few extra debug messages:

Jul 16 19:52:18  /netbsd: hci_usrreq: ATTACH
Jul 16 19:52:18  /netbsd: hci_usrreq: CONTROL
Jul 16 19:52:18  /netbsd: hci_ioctl: cmd 0xc0386205
Jul 16 19:52:18  /netbsd: hci_usrreq: CONTROL
Jul 16 19:52:18  /netbsd: hci_ioctl: cmd 0xc0386208
Jul 16 19:52:18  /netbsd: ubt_enable: sc=3D0xc1f89400
Jul 16 19:52:18  /netbsd: hci_send_cmd: (ubt0) opcode (004|0009)
Jul 16 19:52:18  /netbsd: hci_output_cmd: (ubt0) num_cmd_pkts=3D1
Jul 16 19:52:18  /netbsd: hci_send_cmd: (ubt0) opcode (004|0005)
Jul 16 19:52:18  /netbsd: hci_send_cmd: (ubt0) opcode (004|0003)
Jul 16 19:52:18  /netbsd: hci_intr: (ubt0) recv event, len =3D 13
Jul 16 19:52:18  /netbsd: hci_event: (ubt0) event COMMAND COMPLETE
Jul 16 19:52:18  /netbsd: hci_event_command_compl: (ubt0) opcode (004|0009)=
=20
num_cmd_pkts =3D 1
Jul 16 19:52:18  /netbsd: hci_output_cmd: (ubt0) num_cmd_pkts=3D1
Jul 16 19:52:18  /netbsd: hci_intr: done
Jul 16 19:52:19  /netbsd: ubt_disable: sc=3D0xc1f89400
Jul 16 19:52:19  /netbsd: ubt_abortdealloc: sc=3D0xc1f89400
Jul 16 19:52:19  /netbsd: ubt_recv_acl_complete: status=3DCANCELLED (6)
Jul 16 19:52:19  /netbsd: hci_usrreq: DETACH


cheerio Berndt


--nextPart1202516.iTN9MuebEW
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.4 (NetBSD)

iD8DBQBEuhQ2cUIHpeIRpjERAoHfAKCxnhrHR5O5uRBgp/zH1OeeS5h5BACgxLiy
TYiOo//3gt/zNZS5llTVlT4=
=Id+Q
-----END PGP SIGNATURE-----

--nextPart1202516.iTN9MuebEW--