usb
Reset usb device
- lsusb
- cc resetusb.c -o resetusb
- cp resetusb /usr/sbin
- #bus 004 device 006
- ./resetusb /dev/bus/usb/004/006
1 #include <stdio.h>
2 #include <fcntl.h>
3 #include <errno.h>
4 #include <sys/ioctl.h>
5 #include <linux/usbdevice_fs.h>
6 void main(int argc, char **argv)
7 {
8 const char *filename;
9 int fd;
10 filename = argv[1];
11 fd = open(filename, O_WRONLY);
12 ioctl(fd, USBDEVFS_RESET, 0);
13 close(fd);
14 return;
15 }