I have now been using mint for almost 3 years. As an embedded systems coder, I have to use various USB devices as IC flashing tools. Now, I have run into a peculiar problem that I have managed to narrow down to the Linux system.
There is a device programmer that is detected well and shows up in 'lsusb'. It can be connected to a VM guest and used correctly. However, upgrading the firmware of the same device programmer to its newer version causes a USB device error in the VM guest. Investigating further, I decided to check if I could perform a USBreset of the device from the mint command line.
I use this attached code
Code: Select all
#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");
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;
}
There are other devices that fall in the same category. These fail when the reset command goes out to the device.Resetting USB device /dev/bus/usb/003/012
Error in ioctl: No such device
I need help to find out how this can be fixed. It is definitely an issue with the underlying USB sources of mint