Skip to content

Instantly share code, notes, and snippets.

@shayne
Created December 1, 2016 02:22
Show Gist options
  • Save shayne/3ce20d47ed1a42298e2c132d615e814f to your computer and use it in GitHub Desktop.
Save shayne/3ce20d47ed1a42298e2c132d615e814f to your computer and use it in GitHub Desktop.
reset usb bus linux
#include <stdio.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/ioctl.h>
#include <linux/usbdevice_fs.h>
void main(int argc, char **argv)
{
const char *filename;
int fd;
filename = argv[1];
fd = open(filename, O_WRONLY);
ioctl(fd, USBDEVFS_RESET, 0);
close(fd);
return;
}
@shayne
Copy link
Author

shayne commented Dec 1, 2016

sudo ./reset /dev/bus/usb/003/002

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment