diff --git a/services/usb-bao1x/Cargo.toml b/services/usb-bao1x/Cargo.toml index 24db010f6..8a05265ae 100644 --- a/services/usb-bao1x/Cargo.toml +++ b/services/usb-bao1x/Cargo.toml @@ -58,6 +58,7 @@ board-baosec = [ "bao1x-hal", "bao1x-hal-service", ] +oem-baosec-lite = ["bao1x-hal/oem-baosec-lite"] board-dabao = ["utralib/bao1x", "utralib/std", "bao1x-hal", "bao1x-hal-service"] hosted-baosec = ["utralib/hosted", "utralib/std", "bao1x-emu"] # none of these other modes are actually supported, but are listed here diff --git a/services/usb-bao1x/src/hw.rs b/services/usb-bao1x/src/hw.rs index c5365d20a..ab169c68d 100644 --- a/services/usb-bao1x/src/hw.rs +++ b/services/usb-bao1x/src/hw.rs @@ -87,14 +87,16 @@ impl<'a> Bao1xUsb<'a> { // to concurrently add that in - you have to kick out one of the interfaces above to add mass // storage!) - #[cfg(feature = "board-baosec")] + #[cfg(feature = "oem-baosec-lite")] + let product = "Baosec-lite"; + #[cfg(all(feature = "board-baosec", not(feature = "oem-baosec-lite")))] let product = "Baosec"; #[cfg(feature = "board-baosec")] - let pid = 0x6198; // pending PR acceptance + let pid = 0x6198; #[cfg(feature = "board-dabao")] let product = "Dabao"; #[cfg(feature = "board-dabao")] - let pid = 0x6197; // pending PR acceptance + let pid = 0x6197; let device = UsbDeviceBuilder::new(&usb_alloc, UsbVidPid(0x1d50, pid)) .manufacturer("Baochip") .product(product) @@ -160,7 +162,7 @@ impl<'a> Bao1xUsb<'a> { /// Process an unplug event - only valid on baosec, because dabao doesn't have a battery and unplugging /// it would power it down. - #[cfg(feature = "board-baosec")] + #[cfg(all(feature = "board-baosec", not(feature = "oem-baosec-lite")))] pub fn unplug(&mut self) { // disable all interrupts so we can safely go through initialization routines self.irq_csr.wo(utra::irqarray1::EV_ENABLE, 0); diff --git a/services/usb-bao1x/src/main.rs b/services/usb-bao1x/src/main.rs index e69d697e1..37c52ba28 100644 --- a/services/usb-bao1x/src/main.rs +++ b/services/usb-bao1x/src/main.rs @@ -52,7 +52,7 @@ pub(crate) fn main_hw() -> ! { use api::*; use bao1x_api::IoGpio; use bao1x_api::keyboard::KeyMap; - #[cfg(feature = "board-baosec")] + #[cfg(all(feature = "board-baosec", not(feature = "oem-baosec-lite")))] use bao1x_hal::axp2101::VbusIrq; use bao1x_hal::usb::driver::{CorigineUsb, CorigineWrapper}; use hw::{Bao1xUsb, UsbIrqReq}; @@ -260,9 +260,9 @@ pub(crate) fn main_hw() -> ! { }); let iox = bao1x_api::IoxHal::new(); - #[cfg(feature = "board-baosec")] + #[cfg(all(feature = "board-baosec", not(feature = "oem-baosec-lite")))] let mut i2c = bao1x_hal::i2c::I2c::new(); - #[cfg(feature = "board-baosec")] + #[cfg(all(feature = "board-baosec", not(feature = "oem-baosec-lite")))] let pmic = { log::info!("Registering PMIC handler to detect USB plug/unplug events"); bao1x_hal::board::setup_pmic_irq( @@ -292,7 +292,7 @@ pub(crate) fn main_hw() -> ! { ); } match opcode { - #[cfg(feature = "board-baosec")] + #[cfg(all(feature = "board-baosec", not(feature = "oem-baosec-lite")))] Opcode::PmicIrq => match pmic.get_vbus_irq_status(&mut i2c).unwrap() { VbusIrq::Insert => { log::error!("VBUS insert reported by PMIC, but we didn't ask for the event!");