From da9ed129e381f1c8ffbe63cc3716ad57d68d00ef Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Wed, 3 May 2023 16:18:19 +0200 Subject: [PATCH] Contourdesign: Implement USB probe/match --- libs/surfaces/contourdesign/contourdesign.cc | 9 +++++++++ libs/surfaces/contourdesign/contourdesign.h | 1 + libs/surfaces/contourdesign/interface.cc | 2 +- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/libs/surfaces/contourdesign/contourdesign.cc b/libs/surfaces/contourdesign/contourdesign.cc index 2604519a67..a7fa14b4b4 100644 --- a/libs/surfaces/contourdesign/contourdesign.cc +++ b/libs/surfaces/contourdesign/contourdesign.cc @@ -97,6 +97,15 @@ ContourDesignControlProtocol::available () return rv; } +bool +ContourDesignControlProtocol::match_usb (uint16_t vendor, uint16_t p) +{ + if (vendor != ContourDesign) { + return false; + } + return (p == ShuttlePRO_id || p == ShuttlePRO_v2_id || p == ShuttleXpress_id); +} + int ContourDesignControlProtocol::set_active (bool yn) { diff --git a/libs/surfaces/contourdesign/contourdesign.h b/libs/surfaces/contourdesign/contourdesign.h index 57770cf5ae..c8cf2774a4 100644 --- a/libs/surfaces/contourdesign/contourdesign.h +++ b/libs/surfaces/contourdesign/contourdesign.h @@ -85,6 +85,7 @@ public: DeviceType device_type() const { return _device_type; } static bool available (); + static bool match_usb (uint16_t, uint16_t); int set_active (bool yn); diff --git a/libs/surfaces/contourdesign/interface.cc b/libs/surfaces/contourdesign/interface.cc index 4b15891437..67b125a03a 100644 --- a/libs/surfaces/contourdesign/interface.cc +++ b/libs/surfaces/contourdesign/interface.cc @@ -50,7 +50,7 @@ static ControlProtocolDescriptor contourdesign_descriptor = { /* module */ 0, /* available */ ContourDesignControlProtocol::available, /* probe port */ 0, - /* match usb */ 0, + /* match usb */ ContourDesignControlProtocol::match_usb, /* initialize */ new_contourdesign_protocol, /* destroy */ delete_contourdesign_protocol, };