Re: Still can't claim interface, "No such file or directory" (Part 1)

View: New views
2 Messages — Rating Filter:   Alert me  

Re: Still can't claim interface, "No such file or directory" (Part 1)

by Kustaa Nyholm-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Sending this in several parts because it was bounced as too long, this is part 1/3

Finally had some time to get back to my usb problem.

Spent a few hours trying to get the usbmon to work
for me. Alan wrote:

 >       mount -t debugfs none /sys/kernel/debug
 >       modprobe usbmon

However, the first one executed without any messages
but the second one failed with:

 FATAL: Module usbmon not found.

After re-reading the usbmon.txt I noticed that:

" 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. (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?

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?

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.

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.

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 also get the feeling that Ubuntu
is not the choice of/for the happy hacker, however
my target audience is people who want to 'hack'
weather (stations), not software, atleast not ubs/kernel
stuff. I'm not 100% committed to Ubuntu but I realy
need a distro that is very recent, maintained, small
download and works out of the box for ordinary folks.
And Ubuntu seems to fit the bill, if I only could
read those 8 bytes that my weather stations send
through usb!

cheers Kusti


-------------------------------------------------------------------
Output from sudo cat /sys/kernel/debug/usbmon/0u

df3f7380 788487866 S Ci:1:001:0 s a3 00 0000 0001 0004 4 <
df3f7380 788488172 C Ci:1:001:0 0 4 = 00010000
df3f7380 788488216 S Ci:1:001:0 s a3 00 0000 0002 0004 4 <
df3f7380 788488247 C Ci:1:001:0 0 4 = 00010000
df3f7380 788488276 S Ci:1:001:0 s a3 00 0000 0003 0004 4 <
df3f7380 788488304 C Ci:1:001:0 0 4 = 00010000
df3f7380 788488333 S Ci:1:001:0 s a3 00 0000 0004 0004 4 <
df3f7380 788488361 C Ci:1:001:0 0 4 = 00010000
df3f7380 788488390 S Ci:1:001:0 s a3 00 0000 0005 0004 4 <
df3f7380 788488418 C Ci:1:001:0 0 4 = 00010000
df3f7380 788488446 S Ci:1:001:0 s a3 00 0000 0006 0004 4 <
df3f7380 788488474 C Ci:1:001:0 0 4 = 00010000
dd5e3980 788488503 S Ii:1:001:1 -115:2048 4 <
df3f7380 788527855 S Ci:2:001:0 s a3 00 0000 0001 0004 4 <
df3f7380 788527979 C Ci:2:001:0 0 4 = 01030100
df3f7380 788528016 S Co:2:001:0 s 23 01 0010 0001 0000 0
df3f7380 788528046 C Co:2:001:0 0 0
df3f7380 788528074 S Ci:2:001:0 s a3 00 0000 0002 0004 4 <
df3f7380 788528103 C Ci:2:001:0 0 4 = 00010000
dd5e3a80 788631868 S Ii:2:001:1 -115:128 2 <
df3f7380 788632006 S Ci:2:001:0 s a3 00 0000 0001 0004 4 <
df3f7380 788632043 C Ci:2:001:0 0 4 = 01030000
df3f7380 788632085 S Co:2:001:0 s 23 03 0004 0001 0000 0
df3f7380 788632115 C Co:2:001:0 0 0
df3f7380 788687868 S Ci:2:001:0 s a3 00 0000 0001 0004 4 <
df3f7380 788688002 C Ci:2:001:0 0 4 = 03030000
df3f7380 788743854 S Co:2:001:0 s 23 01 0014 0001 0000 0
df3f7380 788743968 C Co:2:001:0 0 0
df3f7380 788744021 S Ci:2:000:0 s 80 06 0100 0000 0040 64 <
df3f7380 788750903 C Ci:2:000:0 0 18 = 12011001 00000008 de0f01ca 02030001 0001
df3f7380 788750986 S Co:2:001:0 s 23 03 0004 0001 0000 0
df3f7380 788751019 C Co:2:001:0 0 0
df3f7380 788803887 S Ci:2:001:0 s a3 00 0000 0001 0004 4 <
df3f7380 788804024 C Ci:2:001:0 0 4 = 03030000
df3f7380 788859870 S Co:2:001:0 s 23 01 0014 0001 0000 0
df3f7380 788859984 C Co:2:001:0 0 0
df3f7380 788860021 S Co:2:000:0 s 00 05 0004 0000 0000 0
df3f7380 788862908 C Co:2:000:0 0 0
df3f7380 788879856 S Ci:2:004:0 s 80 06 0100 0000 0012 18 <
df3f7380 788884912 C Ci:2:004:0 0 18 = 12011001 00000008 de0f01ca 02030001 0001
df3f7380 788884995 S Ci:2:004:0 s 80 06 0200 0000 0009 9 <
df3f7380 788889909 C Ci:2:004:0 0 9 = 09022200 01010080 32
df3f7380 788890055 S Ci:2:004:0 s 80 06 0200 0000 0022 34 <
df3f7380 788897912 C Ci:2:004:0 0 34 = 09022200 01010080 32090400 00010300 00000921 10010001 22220007 05810308
df3f7380 788897999 S Ci:2:004:0 s 80 06 0300 0000 00ff 255 <
df3f7380 788902906 C Ci:2:004:0 0 4 = 04030904
df3f7380 788903050 S Ci:2:004:0 s 80 06 0301 0409 00ff 255 <
df3f7380 788911908 C Ci:2:004:0 0 34 = 22035500 6e006900 76006500 72007300 61006c00 20004200 72006900 64006700
df3f7400 788915696 S Co:2:004:0 s 00 09 0001 0000 0000 0
df3f7400 788917917 C Co:2:004:0 0 0
df3f7400 788918239 S Co:2:004:0 s 21 0a 0000 0000 0000 0
df3f7400 788920907 C Co:2:004:0 0 0
df3f7400 788921009 S Ci:2:004:0 s 81 06 2200 0000 0022 34 <
df3f7400 788928916 C Ci:2:004:0 0 34 = 0600ff09 01a10109 01150026 ff007508 95088100 09021500 26ff0075 08950891
df3f7080 788929828 S Ci:2:004:0 s a1 01 0100 0000 0008 8 <
df3f7080 788931912 C Ci:2:004:0 -32 0
df3f7400 789241181 S Ii:2:004:1 -115:1 8 <
df3f7400 789254921 C Ii:2:004:1 -2:1 0
dd5e3980 791135873 C Ii:1:001:1 -2:2048 0
d620e700 804943864 S Ci:1:001:0 s a3 00 0000 0001 0004 4 <
d620e700 804944245 C Ci:1:001:0 0 4 = 00010000
d620e700 804944305 S Ci:1:001:0 s a3 00 0000 0002 0004 4 <
d620e700 804944338 C Ci:1:001:0 0 4 = 00010000
d620e700 804944369 S Ci:1:001:0 s a3 00 0000 0003 0004 4 <
d620e700 804944398 C Ci:1:001:0 0 4 = 00010000
d620e700 804944426 S Ci:1:001:0 s a3 00 0000 0004 0004 4 <
d620e700 804944455 C Ci:1:001:0 0 4 = 00010000
d620e700 804944484 S Ci:1:001:0 s a3 00 0000 0005 0004 4 <
d620e700 804944699 C Ci:1:001:0 0 4 = 00010000
d620e700 804944736 S Ci:1:001:0 s a3 00 0000 0006 0004 4 <
d620e700 804944766 C Ci:1:001:0 0 4 = 00010000
dd5e3980 804944796 S Ii:1:001:1 -115:2048 4 <
d620e800 805009327 S Ci:3:001:0 s a3 00 0000 0001 0004 4 <
d620e800 805009700 C Ci:3:001:0 0 4 = 00010000
d620e800 805009746 S Ci:3:001:0 s a3 00 0000 0002 0004 4 <
d620e800 805009778 C Ci:3:001:0 0 4 = 00010000
dd5e3b80 805009877 S Ii:3:001:1 -115:128 2 <
dd0e0600 806429271 S Co:2:004:0 s 00 09 0000 0000 0000 0
dd0e0600 806431484 C Co:2:004:0 0 0
dd5e3980 807135888 C Ii:1:001:1 -2:2048 0
dd5e3b80 807136140 C Ii:3:001:1 -2:128 0
-------------------------------------------------------------------

And here is my code (exactly from this run):

        static USB_device findDevice(int vendor, int product, int device) {
                int busses = usb_find_busses();
                int devices = usb_find_devices();
                USB_device thedev = null;
                for (USB_bus bus = usb_get_busses(); bus != null; bus = bus.next) {
                        for (USB_device dev = bus.devices; dev != null; dev = dev.next) {
                                System.out.println(dev);
                                if (vendor >= 0 && vendor != (dev.descriptor.idVendor & 0xFFFF))
                                        continue;
                                if (product >= 0 && product != (dev.descriptor.idProduct & 0xFFFF))
                                        continue;
                                if (device >= 0 && device != (dev.descriptor.bcdDevice & 0xFFFF))
                                        continue;
                                System.out.println((dev.descriptor.idVendor & 0xFFFF) + " " + (dev.descriptor.idProduct & 0xFFFF) + " " + (dev.descriptor.bcdDevice & 0xFFFF));
                                return dev;
                        }
                }
                return null;
        }

<snip>

        usb_init();

        int ret;

        usb_set_debug(10);

        USB_device device = findDevice(0x0FDE, 0xCA01, -1); //Ohio scientific
        assertOk(device != null ? 0 : NON_STD_ERR, "findDevice");

        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");
                                       
        //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");

-------------------------------------------------------------------
And here is the output from that code:

usb_set_debug: Setting debugging level to 10 (on)
usb_os_find_busses: Found 001
usb_os_find_busses: Found 004
usb_os_find_busses: Found 003
usb_os_find_busses: Found 002
usb_os_find_devices: Found 001 on 001
usb_os_find_devices: Found 002 on 004
usb_os_find_devices: Found 001 on 004
error obtaining child information: Inappropriate ioctl for device
usb_os_find_devices: Found 001 on 003
usb_os_find_devices: Found 004 on 002
skipped 1 class/vendor specific interface descriptors
usb_os_find_devices: Found 001 on 002
error obtaining child information: Inappropriate ioctl for device
USB_device 1D6B 0002
USB_device 044E 3001
USB_device 1D6B 0001
USB_device 1D6B 0001
USB_device 0FDE CA01
4062 51713 770
usb_claim_interface failed, ret val -2 = could not claim interface 0: No such file or directory
USB error: could not claim interface 0: No such file or directory
       

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Libusb-devel mailing list
Libusb-devel@...
https://lists.sourceforge.net/lists/listinfo/libusb-devel

Re: Still can't claim interface, "No such file or directory" (Part 1)

by Alan Stern :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Libusb-devel mailing list
Libusb-devel@...
https://lists.sourceforge.net/lists/listinfo/libusb-devel