6 #include <linux/usbdevice_fs.h>
9 //Resets an USB device (akin to disconnecting and re-connecting it)
10 //See http://www.roman10.net/how-to-reset-usb-device-in-linux/
11 //Compile with gcc -Wall -o usbreset usbreset.c
13 int main(int argc
, char **argv
){
14 int fd
= open(argv
[1], O_WRONLY
);
16 fprintf(stderr
, "Cannot open the given USB device: %s\n", strerror(errno
));
19 if(ioctl(fd
, USBDEVFS_RESET
, 0)){
20 fprintf(stderr
, "Error while invoking the ioctl on the given device: %s\n", strerror(errno
));