summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2013-06-22 00:38:02 +0200
committerPřemysl Janouch <p.janouch@gmail.com>2013-06-22 13:30:30 +0200
commit47a80ce71e73bcf5a8bdde318984150414f85faa (patch)
tree8f3e797cfeb862908457e192f8bdeebbb4f7978a
parent22680c4c9d5c12655a588c767ff19228e81702b7 (diff)
downloadsensei-raw-ctl-47a80ce71e73bcf5a8bdde318984150414f85faa.tar.gz
sensei-raw-ctl-47a80ce71e73bcf5a8bdde318984150414f85faa.tar.xz
sensei-raw-ctl-47a80ce71e73bcf5a8bdde318984150414f85faa.zip
Add support for SteelSeries Call of Duty
-rw-r--r--README5
-rw-r--r--sensei-raw-ctl.c35
2 files changed, 37 insertions, 3 deletions
diff --git a/README b/README
index 0e7c32f..327e88f 100644
--- a/README
+++ b/README
@@ -10,6 +10,11 @@ If you don't fancy command line tools, there's also a basic GTK+ frontend
available. On Ubuntu and its derivates, you should be able to find it in your
System Settings.
+Supported devices
+=================
+ - SteelSeries Sensei Raw
+ - SteelSeries Call of Duty: Black Ops II
+
Installation
============
Build dependencies: cmake >= 2.8.5, help2man, libusb >= 1.0,
diff --git a/sensei-raw-ctl.c b/sensei-raw-ctl.c
index 821879d..3c2dbb6 100644
--- a/sensei-raw-ctl.c
+++ b/sensei-raw-ctl.c
@@ -81,10 +81,33 @@ out:
return handle;
}
+/** Search for a device under various product ID's. */
+static libusb_device_handle *
+find_device_list (int vendor,
+ const int *products, size_t n_products, int *error)
+{
+ int err = 0;
+ libusb_device_handle *handle;
+
+ while (n_products--)
+ {
+ handle = find_device (vendor, *products++, &err);
+ if (handle)
+ return handle;
+ if (err)
+ break;
+ }
+
+ if (error != NULL && err != 0)
+ *error = err;
+ return NULL;
+}
+
// --- Device configuration ----------------------------------------------------
#define USB_VENDOR_STEELSERIES 0x1038
-#define USB_PRODUCT_STEELSERIES_SENSEI 0x1369
+#define USB_PRODUCT_STEELSERIES_SENSEI_RAW 0x1369
+#define USB_PRODUCT_STEELSERIES_COD_BO2 0x136f
#define USB_GET_REPORT 0x01
#define USB_SET_REPORT 0x09
@@ -511,9 +534,15 @@ main (int argc, char *argv[])
ERROR (error_0, "libusb initialisation failed: %s\n",
libusb_error_name (result));
+ static const int products[] =
+ {
+ USB_PRODUCT_STEELSERIES_SENSEI_RAW,
+ USB_PRODUCT_STEELSERIES_COD_BO2
+ };
+
result = 0;
- libusb_device_handle *device = find_device
- (USB_VENDOR_STEELSERIES, USB_PRODUCT_STEELSERIES_SENSEI, &result);
+ libusb_device_handle *device = find_device_list (USB_VENDOR_STEELSERIES,
+ products, sizeof products / sizeof products[0], &result);
if (!device)
{
if (result)