|
From: Alan S. <st...@ro...> - 2009-10-17 15:59:04
|
On Sat, 17 Oct 2009, Kustaa Nyholm wrote: > " Mount debugfs (it has to be enabled in your kernel configuration), and > " load the usbmon module (if built as module). The second step is skipped > " if usbmon is built into the kernel. > " mount -t debugfs none_debugs /sys/kernel/debug > " modprobe usbmon > > Note the 'none_debugs' is slightly different from what Alan wrote and > that the second step may not be necessary. That particular word in this mount command is ignored. You can put almost anything you want in that spot. "none" is traditional. > (I'm not complaining > just detailing what I did posterity) From some other > web page I noted that Ubuntu 9.04 has some usbmon related > stuff 'enabled' and there is no need to recompile the kernel, > so I infered that maybe I do not need that second step. > > Is this correct? Yes. > Ok, moving on. I verified, as explained in the usbmon.txt, that > I can do: > > ls /sys/kernel/debug/usbmon > 0s 0u 1s 1t 1u 2s 2t 2u 3s 3t 3u 4s 4t 4u > > But trying to find out about my device using: > > cat /proc/bus/usb/devices > > fails, because there is nothing under /proc/bus/usb/ > however all the devices in my system can be found > under /dev/bus/usb > > Is this ok / significant? It is okay. You can get the information about your device from the dmesg log; it shows that your device was on bus 2. So you could have used the 2u file, but 0u is okay. > Anyway, I did: > > sudo cat /sys/kernel/debug/usbmon/0u >/home/nyholku/Desktop/usbcapture.txt > > plugged in my device and run my code. I'm attaching all the > information from the run and some other stuff that Alan and > some other helpful people suggested could help to debug this > issue. Comments below. > Xiaofan suggested deleting my modified udev rule, I tried this > but then my device cannot be found at all by libusb. > > Alan or someone else suggested something else too to set > some debug flag or get some output but I can't find the mail > which is strange as I never delete anything. If this rings > a bell, please repeat what you suggested. It was the usbfs_snoop parameter, which you did eventually remember. > Over to you guys, what should/could I try next? > > I'm sort of getting the feeling that this might be an > issue with Ubuntu. I don't think so. More likely it's a bug in the Java bindings for libusb. > Output from sudo cat /sys/kernel/debug/usbmon/0u The initial part shows your device being plugged in; it isn't important. I'll skip directly to the part where you ran your program: > dd0e0600 806429271 S Co:2:004:0 s 00 09 0000 0000 0000 0 > dd0e0600 806431484 C Co:2:004:0 0 0 This is the Set-Configuration request. The trace shows that the config was set to 0, not 1. ... > USB_dev_handle dev = usb_open(device); > assertOk(dev != null ? 0 : NON_STD_ERR, "usb_open"); > > ret = usb_set_configuration(dev, 1); > assertOk(ret, "usb_set_configuration"); Since your program tried to set config 1, the simplest conclusion is that the 1 got changed to 0 somewhere between your program and the kernel. Most likely in the libusb bindings. > //ret = usb_detach_kernel_driver_np(dev, 0); > //assertOk(ret, "usb_detach_kernel_driver_np"); > > > ret = usb_claim_interface(dev, 0); > assertOk(ret, "usb_claim_interface"); I suggest you work around this bug by getting rid of the usb_set_configuration() call and adding back the usb_detach_kernel_driver_np() call. Alan Stern |