How to detach ftdi kernel driver in android? -


i've tried detach ftdi kernel driver in android (libftdi-0.x code):

#ifdef libusb_has_get_driver_np // try detach ftdi_sio kernel module. // returns enodata if driver not loaded. // // return code kept in separate variable , parsed // if usb_set_configuration() or usb_claim_interface() fails // detach operation might denied , still works fine. // scenario static ftdi_sio kernel module. fprintf(stderr, "detaching kernel driver... \n"); if (ftdi->module_detach_mode == auto_detach_sio_module) {     fprintf(stderr, "usb_detach_kernel_driver_np() ...\n");     if (usb_detach_kernel_driver_np(ftdi->usb_dev, ftdi->interface) != 0 && errno != enodata) {         fprintf(stderr, "failed detach\n");         detach_errno = errno;     } } #endif 

since next invocations device fail error=32 (epipe) believe it's not detached actually:

fprintf(stderr, "ftdi set configuration\n");     if (dev->descriptor.bnumconfigurations > 0)     {         // libusb-win32 on windows 64 can return null pointer valid device         if (dev->config) {             config_val = dev->config[0].bconfigurationvalue;             fprintf(stderr, "trying set configuration %i\n", config_val);         }          if (usb_set_configuration(ftdi->usb_dev, config_val) && errno != ebusy)         {             ftdi_usb_close_internal (ftdi);             if (detach_errno == eperm)             {                 ftdi_error_return(-8, "inappropriate permissions on device!");             }             else             {                 ftdi_error_return(-3, "unable set usb configuration. make sure default ftdi driver not in use");             }         }     } 

log:

08-08 11:40:54.197: warn/system.err(31772): trying set configuration 1 08-08 11:40:54.197: warn/system.err(31772): libusb-compat debug: usb_set_configuration: configuration 1 08-08 11:40:54.197: warn/system.err(31772): libusb: 0.005311 debug [libusb_set_configuration] configuration 1 08-08 11:40:54.197: warn/system.err(31772): libusb: 0.007173 error [op_set_configuration] failed, error -1 errno 32 

according comment above seems not detached result okay.

any ideas on how detach or actual result @ least? walk-around?

update: i've tried on 2 android devices both usb-host support on android 4.0.x , android 4.1 2 different ftdi-devices.

update: i've created android issue

i came across below thread while ago:

http://developer.intra2net.com/mailarchive/html/libftdi/2011/msg00024.html

it mentioned detaching may need root privilege work properly. so, if running on rooted device, result same?


Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -