3030#include "main.h" /* for getval() */
3131#include "usb-common.h"
3232
33- #define IDOWELL_HID_VERSION "iDowell HID 0.20 "
33+ #define IDOWELL_HID_VERSION "iDowell HID 0.21 "
3434/* FIXME: experimental flag to be put in upsdrv_info */
35+ /* v0.21 GoldenMate LiFePO4 packs reuse the shared Phoenixtec VID (0x06da):
36+ * claim only those (by -BMS-/Smart-Battery firmware strings) and defer
37+ * everything else on that VID to liebert-hid / mge-hid */
3538/* v0.20 Goldenmate also uses the same vendorID and productID so added additional HID2NUT lookup values */
3639
3740/* iDowell, Goldenmate */
3841#define IDOWELL_VENDORID 0x075d
3942
43+ /* Phoenixtec Power Co., Ltd; this VID is shared with liebert-hid (the default
44+ * sink for 0x06da) and mge-hid (AEG PROTECT NAS). GoldenMate 1000VA/800W
45+ * LiFePO4 packs reuse 0x06da:0xffff with the same iDowell-style -BMS- firmware
46+ * and HID descriptor as 0x075d:0x0300, so the table match is gated by device
47+ * strings in idowell_claim() to avoid hijacking the other 0x06da devices. */
48+ #define PHOENIXTEC_VENDORID 0x06da
49+
4050/* USB IDs device table */
4151static usb_device_id_t idowell_usb_device_table [] = {
4252 /* iDowell, Goldenmate */
4353 { USB_DEVICE (IDOWELL_VENDORID , 0x0300 ), NULL },
54+ /* GoldenMate 1000VA/800W LiFePO4; claim gated by strings, see idowell_claim() */
55+ { USB_DEVICE (PHOENIXTEC_VENDORID , 0xffff ), NULL },
4456
4557 /* Terminating entry */
4658 { 0 , 0 , NULL }
@@ -147,6 +159,23 @@ static const char *idowell_format_serial(HIDDevice_t *hd) {
147159 return hd -> Serial ;
148160}
149161
162+ /* The Phoenixtec vendor ID (0x06da) is shared between several subdrivers:
163+ * liebert-hid is the default sink, mge-hid grabs AEG PROTECT NAS, and we want
164+ * only the GoldenMate LiFePO4 packs. They carry the same iDowell-style BMS
165+ * firmware as the 0x075d:0x0300 device, reporting manufacturer "-BMS-" and
166+ * product "Smart-Battery". Match on those strings so the other 0x06da devices
167+ * fall through to liebert-hid / mge-hid. */
168+ static int idowell_is_goldenmate (HIDDevice_t * hd )
169+ {
170+ if (hd -> Vendor && strstr (hd -> Vendor , "BMS" )) {
171+ return 1 ;
172+ }
173+ if (hd -> Product && strstr (hd -> Product , "Smart-Battery" )) {
174+ return 1 ;
175+ }
176+ return 0 ;
177+ }
178+
150179/* this function allows the subdriver to "claim" a device: return 1 if
151180 * the device is supported by this subdriver, else 0. */
152181static int idowell_claim (HIDDevice_t * hd )
@@ -164,6 +193,11 @@ static int idowell_claim(HIDDevice_t *hd)
164193 return 0 ;
165194
166195 case SUPPORTED :
196+ /* On the shared Phoenixtec VID, only claim GoldenMate; let
197+ * liebert-hid (default sink) and mge-hid (AEG) handle the rest. */
198+ if (hd -> VendorID == PHOENIXTEC_VENDORID && !idowell_is_goldenmate (hd )) {
199+ return 0 ;
200+ }
167201 return 1 ;
168202
169203 case NOT_SUPPORTED :
0 commit comments