Skip to content

Commit

Permalink
Allow vendor and product id to be specified
Browse files Browse the repository at this point in the history
  • Loading branch information
wezm committed Sep 25, 2021
1 parent e297953 commit ad4ecb3
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions src/lib.rs
Expand Up @@ -29,14 +29,6 @@ pub mod matrix;
/// A handly shortcut for the keyberon USB class type.
pub type Class<'a, B, L> = hid::HidClass<'a, B, keyboard::Keyboard<L>>;

/// USB VIP for a generic keyboard from
/// https://github.com/obdev/v-usb/blob/master/usbdrv/USB-IDs-for-free.txt
const VID: u16 = 0x16c0;

/// USB PID for a generic keyboard from
/// https://github.com/obdev/v-usb/blob/master/usbdrv/USB-IDs-for-free.txt
const PID: u16 = 0x27db;

/// Constructor for `Class`.
pub fn new_class<B, L>(bus: &UsbBusAllocator<B>, leds: L) -> Class<'_, B, L>
where
Expand All @@ -49,13 +41,14 @@ where
/// Constructor for a keyberon USB device.
pub fn new_device<'a, B>(
bus: &'a UsbBusAllocator<B>,
vid_pid: UsbVidPid,
manufacturer: &'a str,
product: &'a str,
) -> usb_device::device::UsbDevice<'a, B>
where
B: usb_device::bus::UsbBus,
{
UsbDeviceBuilder::new(bus, UsbVidPid(VID, PID))
UsbDeviceBuilder::new(bus, vid_pid)
.manufacturer(manufacturer)
.product(product)
.serial_number(env!("CARGO_PKG_VERSION"))
Expand Down

0 comments on commit ad4ecb3

Please sign in to comment.