7 #include <linux/usbdevice_fs.h>
9 int main(int argc
, char **argv
) {
12 printf("usbreset - send a port reset to an USB device\n"
13 "this should be equivalent to physically unplugging and replugging a device\n\n"
14 "usage: usbreset /dev/bus/usb/busid/deviceid\n"
15 "e.g. usbreset /dev/bus/usb/002/001\n"
16 "(see lsusb output for bus id and device id)\n");
19 if((fd
= open(argv
[1], O_WRONLY
)) == -1) {;
24 printf("resetting USB device %s\n", argv
[1]);
26 if(ioctl(fd
, USBDEVFS_RESET
, 0) == -1) {
29 } else printf("reset successful\n");