use serial numbers & interim pid/vid in USB stack

This commit is contained in:
bunnie 2025-11-06 14:07:30 +08:00
parent 8402c601d2
commit 664ef0a6c4
2 changed files with 14 additions and 3 deletions

View file

@ -85,9 +85,17 @@ impl<'a> Bao1xUsb<'a> {
// to concurrently add that in - you have to kick out one of the interfaces above to add mass
// storage!)
let device = UsbDeviceBuilder::new(&usb_alloc, UsbVidPid(0x1209, 0x3613))
#[cfg(feature = "board-baosec")]
let product = "Baosec";
#[cfg(feature = "board-baosec")]
let pid = 0x6198; // pending PR acceptance
#[cfg(feature = "board-dabao")]
let product = "Dabao";
#[cfg(feature = "board-dabao")]
let pid = 0x6197; // pending PR acceptance
let device = UsbDeviceBuilder::new(&usb_alloc, UsbVidPid(0x1d50, pid))
.manufacturer("Baochip")
.product("Baosec")
.product(product)
.serial_number(&serial_number)
// this is *required* by the corigine stack
.max_packet_size_0(64)

View file

@ -79,7 +79,10 @@ pub(crate) fn main_hw() -> ! {
log::trace!("registered with NS -- {:?}", usbdev_sid);
let tt = ticktimer::Ticktimer::new().unwrap();
let serial_number = format!("TODO!!"); // implement in bao1x-hal once we have a serial number API
let serial_number = std::env::vars()
.find(|(key, _value)| key == "PUBLIC_SERIAL")
.map(|(_key, value)| value)
.expect("Missing PUBLIC_SERIAL in environment");
let native_kbd = bao1x_api::keyboard::Keyboard::new(&xns).expect("couldn't connect to keyboard service");