From: Anton S. <de...@an...> - 2013-07-30 18:50:43
|
also it fails to set default (0) configuration with the same error message: avrdude: usbdev_open(): error setting configuration 1: Device or resource busy the code: if (dev->config == NULL) { fprintf(stderr, "%s: usbdev_open(): USB device has no configuration\n", progname); goto trynext; } fprintf(stderr, "settings configuration ...\n"); if (usb_set_configuration(udev, dev->config[0].bConfigurationValue)) { fprintf(stderr, "%s: usbdev_open(): error setting configuration %d: %s\n", progname, dev->config[0].bConfigurationValue, usb_strerror()); goto trynext; } 2013/7/31 Anton Smirnov <de...@an...> > finally i was able to fix it by removing close(). interface count is now > positive as i printed interface count before they were copied. > now i'm having "device busy" error: > > avrdude: usbdev_open(): error claiming interface 1: Device or resource busy > > i'm trying to claim the right interface (found it using endpoints count = > 2 for my board) of the right device (found it using pid/vid). > interface was not claimed in android app but the device was just opened to > get file descriptor. > > what can effect it? should i close the device before claiming interface? > > > 2013/7/30 Anton Smirnov <de...@an...> > >> oh, i gave it a try and you were right, Toby! >> It is invoked twice and the second attempt fails because it was closed in >> the first attempt. >> >> So it seems to be liusb bug and it never worked for linux? >> >> Now i'm getting another error: >> >> 07-30 17:42:29.413: WARN/System.err(4536): [ 07-30 17:42:29.413 4536: >> 8038 W/System.err ] >> Interfaces: 0 >> 07-30 17:42:29.413: WARN/System.err(4536): opened device >> 07-30 17:42:29.413: WARN/System.err(4536): settings configuration ... >> 07-30 17:42:29.413: WARN/System.err(4536): libusb-compat debug: >> usb_set_configuration: configuration 1 >> 07-30 17:42:29.413: WARN/System.err(4536): libusb: 0.036655 debug >> [libusb_set_configuration] configuration 1 >> 07-30 17:42:29.413: WARN/System.err(4536): avrdude: usbdev_open(): error >> setting configuration 1: Device or resource busy >> >> It seems that getting configuration failed without error, as interface >> count should be > 0 definitely >> >> >> >> >> >> 2013/7/30 Anton Smirnov <de...@an...> >> >>> Well, i just renamed op_get_config_descriptor to >>> op_get_config_descriptor2 and introduced int fd parameter. >>> Original source code contains closing: >>> http://www.libusb.org/browser/libusb/libusb/os/linux_usbfs.csee op_get_config_descriptor() >>> >>> so i am not sure it's the problem. >>> also closing is done after problem line: >>> off = lseek(fd, DEVICE_DESC_LENGTH, SEEK_SET); >>> >>> >>> 2013/7/30 Toby Gray <tob...@re...> >>> >>>> On 30/07/13 12:18, Anton Smirnov wrote: >>>> >>>> Thank you for helping, Toby. >>>> >>>> > You are closing _fd before returning >>>> Is it hypothesis or you've found where it's closing before returning? >>>> >>>> >>>> The code you pasted closes it! >>>> >>>> >>>> I'm asking since the code is from libusb=0.1 and libusb-1.0 sources >>>> and i did not introduce closing as far as i remember. >>>> >>>> >>>> You did, you introduced op_get_config_descriptor2 which is closing the >>>> file descriptor. >>>> >>>> Regards, >>>> >>>> Toby >>>> >>>> >>> >> > |