Menu

dev.open() problem

Help
Peter
2007-07-23
2012-12-06
  • Peter

    Peter - 2007-07-23

    I have problem open the usb device. I got an USBExeption "could not set config 1: Device or resource busy". Any ideas what the problem could be?

    --------------------------------------------------

    import ch.ntb.usb.Device;
    import ch.ntb.usb.USB;
    import ch.ntb.usb.USBException;

    public class Test {
        public static void main(String[] args) {
            Device dev = USB.getDevice((short) 0x91e, (short) 0x03);
            try {
                byte bConfigurationValue = 1;
                byte bInterfaceNumber = 0;
                byte bAlternateSetting = 0;
                dev.open(bConfigurationValue, bInterfaceNumber, 
                        bAlternateSetting);
            }       
            catch(USBException e) {
                e.printStackTrace();
            }
        }
    }

    -------------------------------------------------

    ch.ntb.usb.USBException: LibusbJava.usb_set_configuration: could not set config 1: Device or resource busy
        at ch.ntb.usb.Device.claim_interface(Device.java:591)
        at ch.ntb.usb.Device.open(Device.java:200)
        at ReadWrite.main(ReadWrite.java:18)

    ---------------------------------------------------
    device info

    002/008     4000091e/40000003
    - Unable to fetch manufacturer string
    - Unable to fetch product string
      wTotalLength:         39
      bNumInterfaces:       1
      bConfigurationValue:  1
      iConfiguration:       0
      bmAttributes:         c0h
      MaxPower:             0
        bInterfaceNumber:   0
        bAlternateSetting:  0
        bNumEndpoints:      3
        bInterfaceClass:    255
        bInterfaceSubClass: 255
        bInterfaceProtocol: 255
        iInterface:         0
          bEndpointAddress: 81h
          bmAttributes:     03h
          wMaxPacketSize:   64
          bInterval:        1
          bRefresh:         0
          bSynchAddress:    0
          bEndpointAddress: 02h
          bmAttributes:     02h
          wMaxPacketSize:   64
          bInterval:        0
          bRefresh:         0
          bSynchAddress:    0
          bEndpointAddress: 83h
          bmAttributes:     02h
          wMaxPacketSize:   8
          bInterval:        0
          bRefresh:         0
          bSynchAddress:    0

     
    • David

      David - 2007-07-24

      The problem is that the kernel thinks that another driver now has claim to the interface.  I'm running into the same problem.  Is this happening every time you run your program?  Mine happens when I run my program and kill it un-gracefully.  At that point, the kernel apparently keeps the  claim on the device for a period of time.

      If you are on Linux, run "dmesg" after you get your error and see if you see something like this:

          Jul 24 05:06:49 kiosk_demo2 kernel: usb usb3: usbfs: interface 0 claimed by hub while 'java' sets config #1

      I'm working on a workaround...

       
    • Peter

      Peter - 2007-07-26

      Thanks David!
      It was the garmin_gps kernel driver that claimed my usb gps device.
      I solved my problem by adding garmin_gps to /etc/modprobe.d/blacklist

      /Peter

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.