Skip to content

Commit

Permalink
Merge 'github/pull/297' (Add support for SU3000LCD2UHV)
Browse files Browse the repository at this point in the history
  • Loading branch information
clepple committed Jun 24, 2016
2 parents 77625a2 + 4eff5b7 commit 07d509f
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 0 deletions.
8 changes: 8 additions & 0 deletions drivers/libhid.c
Expand Up @@ -276,6 +276,7 @@ void HIDDumpTree(hid_dev_handle_t udev, usage_tables_t *utab)
#ifndef SHUT_MODE
/* extract the VendorId for further testing */
int vendorID = usb_device((struct usb_dev_handle *)udev)->descriptor.idVendor;
int productID = usb_device((struct usb_dev_handle *)udev)->descriptor.idProduct;
#endif

/* Do not go further if we already know nothing will be displayed.
Expand Down Expand Up @@ -305,6 +306,13 @@ void HIDDumpTree(hid_dev_handle_t udev, usage_tables_t *utab)
continue;
}
}

/* skip report 0x54 for Tripplite SU3000LCD2UHV due to firmware bug */
if ((vendorID == 0x09ae) && (productID == 0x1330)) {
if (pData->ReportID == 0x54) {
continue;
}
}
#endif

/* Get data value */
Expand Down
2 changes: 2 additions & 0 deletions drivers/tripplite-hid.c
Expand Up @@ -81,6 +81,8 @@ static usb_device_id_t tripplite_usb_device_table[] = {
{ USB_DEVICE(TRIPPLITE_VENDORID, 0x1008), battery_scale_0dot1 },
{ USB_DEVICE(TRIPPLITE_VENDORID, 0x1009), battery_scale_0dot1 },
{ USB_DEVICE(TRIPPLITE_VENDORID, 0x1010), battery_scale_0dot1 },
/* e.g. TrippLite SU3000LCD2UHV */
{ USB_DEVICE(TRIPPLITE_VENDORID, 0x1330), battery_scale_1dot0 },
/* e.g. TrippLite OMNI1000LCD */
{ USB_DEVICE(TRIPPLITE_VENDORID, 0x2005), battery_scale_0dot1 },
/* e.g. TrippLite OMNI900LCD */
Expand Down
15 changes: 15 additions & 0 deletions drivers/usbhid-ups.c
Expand Up @@ -1196,6 +1196,12 @@ static bool_t hid_ups_walk(walkmode_t mode)
double value;
int retcode;

#ifndef SHUT_MODE
/* extract the VendorId for further testing */
int vendorID = usb_device((struct usb_dev_handle *)udev)->descriptor.idVendor;
int productID = usb_device((struct usb_dev_handle *)udev)->descriptor.idProduct;
#endif

/* 3 modes: HU_WALKMODE_INIT, HU_WALKMODE_QUICK_UPDATE and HU_WALKMODE_FULL_UPDATE */

/* Device data walk ----------------------------- */
Expand Down Expand Up @@ -1276,6 +1282,15 @@ static bool_t hid_ups_walk(walkmode_t mode)
fatalx(EXIT_FAILURE, "hid_ups_walk: unknown update mode!");
}

#ifndef SHUT_MODE
/* skip report 0x54 for Tripplite SU3000LCD2UHV due to firmware bug */
if ((vendorID == 0x09ae) && (productID == 0x1330)) {
if (item->hiddata && (item->hiddata->ReportID == 0x54)) {
continue;
}
}
#endif

retcode = HIDGetDataValue(udev, item->hiddata, &value, poll_interval);

switch (retcode)
Expand Down
1 change: 1 addition & 0 deletions scripts/upower/95-upower-hid.rules
Expand Up @@ -102,6 +102,7 @@ ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="1007", ENV{UPOWER_BATTERY_TYPE}="ups
ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="1008", ENV{UPOWER_BATTERY_TYPE}="ups"
ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="1009", ENV{UPOWER_BATTERY_TYPE}="ups"
ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="1010", ENV{UPOWER_BATTERY_TYPE}="ups"
ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="1330", ENV{UPOWER_BATTERY_TYPE}="ups"
ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="2005", ENV{UPOWER_BATTERY_TYPE}="ups"
ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="2007", ENV{UPOWER_BATTERY_TYPE}="ups"
ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="2008", ENV{UPOWER_BATTERY_TYPE}="ups"
Expand Down

0 comments on commit 07d509f

Please sign in to comment.