USB stack getting confused

O'Connor, Daniel darius at dons.net.au
Sun Mar 10 01:01:10 UTC 2019



> On 10 Mar 2019, at 01:55, Hans Petter Selasky <hps at selasky.org> wrote:
> On 3/9/19 11:29 AM, O'Connor, Daniel wrote:
>> If I hold the user space process in gdb 'forever' (eg over night) usbconfig doesn't see the device, but the moment I quit the user space process it can be seen again.
> 
> Check the output from "procstat -ak". Likely your application is not closing the USB handle during device detach and so a deadlock happens.

I ran it while stopped in the debugger..
[maarsytest 23:34] ~> procstat -k 20033
  PID    TID COMM                TDNAME              KSTACK
20033 100135 tclsh8.6            -                   mi_switch thread_suspend_switch ptracestop cursig ast doreti_ast

Then continued it and ran it a few more times..
[maarsytest 23:34] ~> procstat -k 20033
  PID    TID COMM                TDNAME              KSTACK
20033 100135 tclsh8.6            -                   mi_switch sleepq_catch_signals sleepq_wait_sig _sleep pipe_read dofileread kern_readv sys_read amd64_syscall fast_syscall_common
[maarsytest 23:34] ~> procstat -k 20033
  PID    TID COMM                TDNAME              KSTACK
20033 100135 tclsh8.6            -                   mi_switch sleepq_catch_signals sleepq_timedwait_sig _cv_timedwait_sig_sbt seltdwait kern_select sys_select amd64_syscall fast_syscall_common

> Also see:
> libusb20_dev_check_connected() . Poll this function regularly to figure out if disconnect is needed.

Hmm, is this exposed in the libusb10 interface? The code I am using uses that to talk to the device (although I have the source for it so can modify it)

--
Daniel O'Connor
"The nice thing about standards is that there
are so many of them to choose from."
 -- Andrew Tanenbaum




More information about the freebsd-hackers mailing list