1 /* usbreset -- send a USB port reset to a USB device */
5 http://marc.info/?l=linux-usb-users&m=116827193506484&w=2
7 and needs mounted usbfs filesystem
9 sudo mount -t usbfs none /proc/bus/usb
11 There is a way to suspend a USB device. In order to use it,
12 you must have a kernel with CONFIG_PM_SYSFS_DEPRECATED turned on. To
13 suspend a device, do (as root):
15 echo -n 2 >/sys/bus/usb/devices/.../power/state
17 where the "..." is the ID for your device. To unsuspend, do the same
18 thing but with a "0" instead of the "2" above.
20 Note that this mechanism is slated to be removed from the kernel within
21 the next year. Hopefully some other mechanism will take its place.
26 Here's a program to do it. You invoke it as either
28 usbreset /proc/bus/usb/BBB/DDD
32 depending on how your system is set up, where BBB and DDD are the bus and
33 device address numbers.
43 #include <sys/ioctl.h>
45 #include <linux/usbdevice_fs.h>
48 int main(int argc
, char **argv
)
55 fprintf(stderr
, "Usage: usbreset device-filename\n");
60 fd
= open(filename
, O_WRONLY
);
62 perror("Error opening output file");
66 printf("Resetting USB device %s\n", filename
);
67 rc
= ioctl(fd
, USBDEVFS_RESET
, 0);
69 perror("Error in ioctl");
72 printf("Reset successful\n");
This page took 0.04539 seconds and 5 git commands to generate.