Open
Conversation
56654ab to
63d56e4
Compare
ede790b to
2552a1a
Compare
Allow users to change the USB device name, manufacturer, serial number,
VID, and PID as seen by the target host OS. Changes are applied live via
UDC unbind/rebind (brief USB reconnection) and persisted across reboots
via /boot/usb.* files.
- Backend: 3 new API endpoints (GET/SET/RESTORE) on /api/hid/usb-descriptor
that read/write Linux USB gadget ConfigFS at /sys/kernel/config/usb_gadget/g0
- Frontend: USB Descriptor settings panel with preset profiles (generic and
branded devices), custom input fields, serial randomizer, and VID/PID
change confirmation
- Init: S03usbdev reads /boot/usb.{manufacturer,product,serial} at boot
- i18n: Translation keys added to all 24 locale files
Closes sipeed/NanoKVM-USB#8
2552a1a to
cdf4cfb
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this does
Right now, every NanoKVM shows up to the target machine as
sipeed NanoKVMwith VID0x3346/ PID0x1009. That makes it pretty obvious a KVM is plugged in. This PR adds a USB Descriptor section to Settings > Device that lets you change the manufacturer name, product name, serial number, VID, and PID to whatever you want.There are 8 built-in presets (generic keyboard/mouse/composite/HID, plus Logitech K120, Logitech Mouse, Microsoft Keyboard, Dell KB216) or you can type in fully custom values. Changes take effect immediately — the target sees a brief USB reconnect, no NanoKVM reboot needed — and they survive reboots.
UI Screenshot
How it works under the hood
The backend reads and writes the Linux USB gadget ConfigFS files under
/sys/kernel/config/usb_gadget/g0/. To apply changes it locks HID, unbinds the UDC, writes the new values, and rebinds — same pattern the existing virtual disk mount uses. Boot persistence follows the same approach already used for VID/PID overrides (/boot/usb.vid,/boot/usb.pid), extended tomanufacturer,product, andserial.What changed
/api/hid/usb-descriptor(get, set, restore defaults)S03usbdevinit script now reads/boot/usb.{manufacturer,product,serial}at startupTesting
Tested on hardware. Presets populate correctly, custom values apply and show up in
lsusbon the target, VID/PID changes trigger the warning/confirmation flow, serial randomization works, restore defaults cleans everything up, and values persist across reboots.Addresses #745
Addresses #574
Addresses #104