usbip-server

Mouse

A HID boot mouse. Linux binds its usbhid driver to it, and it moves your mouse pointer in a circle, one lap per second, for as long as it is attached.

   
Program out/usb_mouse_device
Source src/usb_mouse/
USB id fa00:0002
Interface HID (class 0x03), boot interface subclass, mouse protocol
Endpoint 0x81 interrupt IN, 4 byte reports, polled every 16 ms

The pointer keeps circling while the mouse is attached, keep a terminal with the detach command ready.

Try It

$ make
$ out/usb_mouse_device &
$ sudo usbip attach -r localhost -b 1-1

The pointer starts circling. Stop it with sudo usbip detach -p 0, or stop the device with Ctrl-C three times.

What You See

USB Mouse Device Activated
USBIPServer: Connected
USBIPProtocol: USBIP_CMD_REQ_DEV_IMPORT '1-1'

The kernel log (journalctl -k) shows the new input device:

input: Virtual UsbIP Virtual HID Mouse as /devices/platform/vhci_hcd.0/usb5/5-1/5-1:1.0/...
hid-generic 0003:FA00:0002.000F: input,hidraw8: USB HID v1.11 Mouse [Virtual UsbIP Virtual HID Mouse] on usb-vhci_hcd.0-1/input0

How It Works

Prototyping

Start here for pointing devices: mice, trackballs, joysticks, touch pads, or anything that reports movement. Change the polling interval in usb_mouse_descriptors.h and the report rate follows, as it would on real hardware.

Troubleshooting