Hi,

John Crawley wrote:
> [...] a command to emulate the
> unplugging and re-plugging of the keyboard would be nice to have.

The internet mentions usbreset(1), available from package "usbutils".

But the source code in
  https://sources.debian.org/src/usbutils/1%3A018-2/usbreset.c
shows that the decisive action is a call to ioctl USBDEVFS_RESET, about
which the Linux kernel documentation
  https://www.kernel.org/doc/Documentation/driver-api/usb.rst
says
-----------------------------------------------------------------------
USBDEVFS_RESET
    Does a USB level device reset. The ioctl parameter is ignored. After
    the reset, this rebinds all device interfaces. File modification
    time is not updated by this request.

        **Warning**

        *Avoid using this call* until some usbcore bugs get fixed, since
        it does not fully synchronize device, interface, and driver (not
        just usbfs) state.
-----------------------------------------------------------------------

The man page is
  https://manpages.debian.org/unstable/usbutils/usbreset.1.en.html
Addressing the USB port looks tricky, as it does not work via /dev file
paths.
("Reset by product name" could be a good choice.)


Have a nice day :)

Thomas

Reply via email to