Hello Alan,

Thank you very much for your advice.

The key is to use the USBDEVFS_DISCONNECT ioctl call. Open the correct device file /proc/bus/usb/BBB/DDD and send that ioctl. It will unbind whichever kernel driver is currently bound to the device, leaving it available for someone else to use.

This sounds what I'm looking for. I wrote the following small program.

--------------release-umass.c-----------------------------------
#include <fcntl.h>
#include <sys/ioctl.h>
#include <linux/usbdevice_fs.h>
#define ERR -1

int main()
{
  int d;
  void *p;
  if((d = open("/proc/bus/usb/002/002", O_RDWR | O_NONBLOCK)) == ERR)
    {
      perror("open");
      exit(1);
    }
  if(ioctl(d, USBDEVFS_DISCONNECT, p) == ERR)
    {
      perror("ioctl");
      exit(1);
    }
  return 0;
}
--------------------------------------------------

The output of lsusb was,
>lsusb
Bus 005 Device 001: ID 0000:0000
Bus 004 Device 002: ID 046d:c00c Logitech, Inc. Optical Wheel Mouse
Bus 004 Device 001: ID 0000:0000
Bus 003 Device 001: ID 0000:0000
Bus 002 Device 002: ID 04da:1b01 Panasonic (Matsushita)
Bus 002 Device 001: ID 0000:0000
Bus 001 Device 001: ID 0000:0000

Panasonic(Matsushita) is the SD card reader.
However when I executed this program, the following error message was displayed.


ioctl: Inappropriate ioctl for device

Since I am a complete novice at system programing, I may have made stupid mistakes.
Do you have any suggestion to solve the problem ?


Regards, Yoichi.


------------------------------------------------------- This SF.Net email is sponsored by The 2004 JavaOne(SM) Conference Learn from the experts at JavaOne(SM), Sun's Worldwide Java Developer Conference, June 28 - July 1 at the Moscone Center in San Francisco, CA REGISTER AND SAVE! http://java.sun.com/javaone/sf Priority Code NWMGYKND _______________________________________________ [EMAIL PROTECTED] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-users

Reply via email to