rogcore: match interface with keyboard endpoint instead

This commit is contained in:
Luke
2020-06-11 09:52:00 +12:00
parent 962216051f
commit 0b51f61f7a
2 changed files with 4 additions and 3 deletions

View File

@@ -38,7 +38,7 @@ pub async fn start_daemon() -> Result<(), Box<dyn Error>> {
let mut rogcore = RogCore::new(
laptop.usb_vendor(),
laptop.usb_product(),
laptop.led_endpoint(),
laptop.key_endpoint(),
)
.map_or_else(
|err| {

View File

@@ -33,7 +33,7 @@ pub struct RogCore {
}
impl RogCore {
pub fn new(vendor: u16, product: u16, led_endpoint: u8) -> Result<RogCore, Box<dyn Error>> {
pub fn new(vendor: u16, product: u16, match_endpoint: u8) -> Result<RogCore, Box<dyn Error>> {
let mut dev_handle = RogCore::get_device(vendor, product).map_err(|err| {
error!("Could not get keyboard device handle: {:?}", err);
err
@@ -50,12 +50,13 @@ impl RogCore {
for iface in dev_config.interfaces() {
for desc in iface.descriptors() {
for endpoint in desc.endpoint_descriptors() {
if endpoint.address() == led_endpoint {
if endpoint.address() == match_endpoint {
info!("INTERVAL: {:?}", endpoint.interval());
info!("MAX_PKT_SIZE: {:?}", endpoint.max_packet_size());
info!("SYNC: {:?}", endpoint.sync_type());
info!("TRANSFER_TYPE: {:?}", endpoint.transfer_type());
info!("ENDPOINT: {:X?}", endpoint.address());
info!("INTERFACE: {:X?}", desc.interface_number());
interface = desc.interface_number();
break;
}