Stefan Reinauer has uploaded this change for review. ( https://review.coreboot.org/c/em100/+/48547 )
Change subject: em100: usb reset utility ......................................................................
em100: usb reset utility
If youre EM100 hangs because of an incomplete transfer, you can use this Linux utility to reset the USB port and get the EM100 working again
Signed-off-by: Stefan Reinauer stefan.reinauer@coreboot.org Change-Id: I5cc9c6108dff5d980c97a92a1ac4a209ea77a3ca --- A usbreset.c 1 file changed, 38 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/em100 refs/changes/47/48547/1
diff --git a/usbreset.c b/usbreset.c new file mode 100644 index 0000000..d0a5c07 --- /dev/null +++ b/usbreset.c @@ -0,0 +1,38 @@ +#include <stdio.h> +#include <unistd.h> +#include <fcntl.h> +#include <errno.h> +#include <sys/ioctl.h> + +#include <linux/usbdevice_fs.h> + +int main(int argc, char **argv) +{ + const char *filename; + int fd; + int rc; + + if (argc != 2) { + fprintf(stderr, "Usage: usbreset device-filename\n"); + fprintf(stderr, " device-filename i.e. /dev/bus/usb/001/024\n"); + return 1; + } + filename = argv[1]; + + fd = open(filename, O_WRONLY); + if (fd < 0) { + perror("Error opening output file"); + return 1; + } + + printf("Resetting USB device %s\n", filename); + rc = ioctl(fd, USBDEVFS_RESET, 0); + if (rc < 0) { + perror("Error in ioctl"); + return 1; + } + printf("Reset successful\n"); + + close(fd); + return 0; +}