Dan Streetman wrote:

I think using the UsbInterfacePolicy.forceClaim() is the best way to do things, and the Linux implementation can keep up with changes the Linux kernel makes in how it's done at a low level. Also, it hopefully will be somewhat portable to other OSes...




To experiment with the UsbInterfacePolicy forceClaim() functionality, I made a small change to the UsbInterfacePanel class in the UsbView tool. I pass an instance of UsbInterfacePolicy which returns true for all three methods as follows:


[EMAIL PROTECTED] swing]$ cvs diff UsbInterfacePanel.java
Index: UsbInterfacePanel.java
===================================================================
RCS file: /cvsroot/javax-usb/javax-usb-ri/src/com/ibm/jusb/tools/swing/UsbInterfacePanel.java,v
retrieving revision 1.5
diff -r1.5 UsbInterfacePanel.java
29a30,41
>
> private class Policy implements javax.usb.UsbInterfacePolicy
> {
>
> public boolean forceClaim(UsbInterface usb_interface) {return true;}
>
> public boolean open(UsbPipe pipe, Object key) {return true;}
>
> public boolean release(UsbInterface usb_interface, Object key) {return true;}
>
> }
>
93c105
< try { usbInterface.claim(); }
---
> try { usbInterface.claim(new Policy()); }
[




Using the latest javax-usb code from CVS on a Redhat 9 system running kernel 2.4.23-pre7 executing the UsbView program as root, the first attempt to forcefully claim an interface fails with "Could not claim interface: Device or resource busy.". The second and all subsequent calls to "claim" succeed. Unplugging and replugging the USB device (or rebooting) puts it back in the state of having the first claim fail again.





-------------------------------------------------------
This SF.net email is sponsored by OSDN developer relations
Here's your chance to show off your extensive product knowledge
We want to know what you know. Tell us and you have a chance to win $100
http://www.zoomerang.com/survey.zgi?HRPT1X3RYQNC5V4MLNSV3E54
_______________________________________________
javax-usb-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/javax-usb-devel

Reply via email to