fix product description & serial number in baremetal

This commit is contained in:
bunnie 2025-11-22 00:53:27 +08:00
parent 5bf4a6416a
commit 4a4b5f182d
2 changed files with 8 additions and 4 deletions

View file

@ -60,10 +60,13 @@ pub fn get_descriptor_request(this: &mut CorigineUsb, value: u16, _index: usize,
ep0_buf[..4].copy_from_slice(&[4, USB_DT_STRING, 9, 4]);
4
} else {
let owc = bao1x_hal::acram::OneWayCounter::new();
let slot_mgr = bao1x_hal::acram::SlotManager::new();
let sn = bao1x_hal::usb::derive_usb_serial_number(&owc, &slot_mgr);
let s = match id {
1 => MANUFACTURER,
2 => PRODUCT,
_ => SERIAL,
_ => &sn,
};
let slen = 2 + s.len() * 2;
ep0_buf[0] = slen as u8;

View file

@ -132,9 +132,10 @@ struct DeviceDescriptor {
const VENDOR_ID: u16 = 0x1209;
const PRODUCT_ID: u16 = 0x3613; // this needs to change! this is the Precursor product ID.
const MANUFACTURER: &'static str = "Baochip";
const PRODUCT: &'static str = "Dabao";
// no seriously, do this
const SERIAL: &'static str = "TODO";
#[cfg(feature = "board-baosec")]
const PRODUCT: &'static str = "Baosec-Baremetal";
#[cfg(not(feature = "board-baosec"))]
const PRODUCT: &'static str = "Dabao-Baremetal";
impl DeviceDescriptor {
pub fn default_usb_acm() -> Self {