On Wed, 14 Dec 2022 06:22:30 -0500
Haines Brown <haines@???> wrote:
> In the course of the night I lost keyboard input. Numlock and Caps
> Lockkey LEDs do not turn on. Mouse is OK. I went to replug my PS2
> keyboard and the PS2-USB adpater separated.
>
> A replacement keyboard and adapter in different USB port do not work.
>
> A dirty reboot may result in my not being able to log in, but is it
> worth a try?
>
Hi,
you can try this C program to reset the usb device.
Hope this helps.
Ciao,
Tito
___________________________________________________________________________-
#include <stdio.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;
}
___________________________________________________________________________________