Hi,
I wrote an application that uses javax.usb to communicate with various usb devices.Currently I am running it under Suse 10.0.
I know that in order for my Java program to be able to see a device (much less talk to it) the permissions have to be appropriately set.  For some reason I have been unable to convince fstab to do that for me so my solution was to use a linux script file that changes the permissions as required.

My question regards the visibility of the devices after changing their permissions with the script file. Running the script changes the permissions and also verifies and reports that the device is there. If, from javax.usb, I walk the tree of available devices I don't always see the new one. If I have the program sleep for 3 seconds before it looks. Then usually I will see the new one (but it is not absolutely guaranteed).

So, the problem I have is that I know the device is there. I know the permissions are set correctly, and if I look too soon, I may not see it via javax.usb. Here is a chopped down example of a recursive routine that I would use to go through the available devices:

/*Call the function which then calls itself recursively to show all devices:*/
listUsbDevices(UsbHostManager.getUsbServices().getRootUsbHub());

public void listUsbDevices(UsbDevice usbDevice) {
    System.out.println(">"+usbDevice); //Print out the device
    if(usbDevice.isUsbHub()) {
      List devices = ((UsbHub) usbDevice).getAttachedUsbDevices();
      for(int i=0; i<devices.size(); i++)
        listUsbDevices((UsbDevice) devices.get(i)); /*Recurse*/
    }
  }


I have two questions:
1. Is there a way I can guarantee that I will see the device? Why does it have this behavior? Ideally I would also eliminate the 3 second waiting period (after I Know it is there but before I look).

2. Are there any suggestions as to how I can get the devices to automatically mount with the correct permissions under Suse 10.0? (this would be much cleaner than my current script based approach).

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
javax-usb-devel mailing list
javax-usb-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/javax-usb-devel

Reply via email to