mirror of
https://gitlab.freedesktop.org/upower/upower.git
synced 2026-05-08 08:58:07 +02:00
Never overwrite ID_PRODUCT or ID_VENDOR
This commit is contained in:
parent
af2e76cacd
commit
821b930371
6 changed files with 51 additions and 24 deletions
|
|
@ -6,17 +6,17 @@
|
|||
#
|
||||
SUBSYSTEM!="usb", GOTO="dkp_csr_end"
|
||||
|
||||
ATTR{idVendor}=="046d", ENV{ID_VENDOR}="Logitech, Inc."
|
||||
ATTR{idVendor}=="046d", ATTR{idProduct}=="c501", ENV{ID_PRODUCT}="Mouse Receiver", ENV{DKP_BATTERY_TYPE}="mouse"
|
||||
ATTR{idVendor}=="046d", ATTR{idProduct}=="c502", ENV{ID_PRODUCT}="Dual Receiver", ENV{DKP_BATTERY_TYPE}="mouse", ENV{DKP_CSR_DUAL}="1"
|
||||
ATTR{idVendor}=="046d", ATTR{idProduct}=="c504", ENV{ID_PRODUCT}="Freedom Optical", ENV{DKP_BATTERY_TYPE}="mouse", ENV{DKP_CSR_DUAL}="1"
|
||||
ATTR{idVendor}=="046d", ATTR{idProduct}=="c505", ENV{ID_PRODUCT}="Elite Duo", ENV{DKP_BATTERY_TYPE}="keyboard"
|
||||
ATTR{idVendor}=="046d", ATTR{idProduct}=="c506", ENV{ID_PRODUCT}="MX700 Optical Mouse", ENV{DKP_BATTERY_TYPE}="mouse"
|
||||
ATTR{idVendor}=="046d", ATTR{idProduct}=="c508", ENV{ID_PRODUCT}="Optical TrackMan", ENV{DKP_BATTERY_TYPE}="mouse"
|
||||
ATTR{idVendor}=="046d", ATTR{idProduct}=="c50e", ENV{ID_PRODUCT}="MX1000 Laser Mouse", ENV{DKP_BATTERY_TYPE}="mouse"
|
||||
ATTR{idVendor}=="046d", ATTR{idProduct}=="c510", ENV{ID_PRODUCT}="Click! Mouse", ENV{DKP_BATTERY_TYPE}="mouse"
|
||||
ATTR{idVendor}=="046d", ATTR{idProduct}=="c512", ENV{ID_PRODUCT}="Keyboard+Mouse Receiver", ENV{DKP_BATTERY_TYPE}="keyboard"
|
||||
ATTR{idVendor}=="046d", ATTR{idProduct}=="c702", ENV{ID_PRODUCT}="Presenter", ENV{DKP_BATTERY_TYPE}="mouse"
|
||||
ATTR{idVendor}=="046d", ENV{DKP_VENDOR}="Logitech, Inc."
|
||||
ATTR{idVendor}=="046d", ATTR{idProduct}=="c501", ENV{DKP_PRODUCT}="Mouse Receiver", ENV{DKP_BATTERY_TYPE}="mouse"
|
||||
ATTR{idVendor}=="046d", ATTR{idProduct}=="c502", ENV{DKP_PRODUCT}="Dual Receiver", ENV{DKP_BATTERY_TYPE}="mouse", ENV{DKP_CSR_DUAL}="1"
|
||||
ATTR{idVendor}=="046d", ATTR{idProduct}=="c504", ENV{DKP_PRODUCT}="Freedom Optical", ENV{DKP_BATTERY_TYPE}="mouse", ENV{DKP_CSR_DUAL}="1"
|
||||
ATTR{idVendor}=="046d", ATTR{idProduct}=="c505", ENV{DKP_PRODUCT}="Elite Duo", ENV{DKP_BATTERY_TYPE}="keyboard"
|
||||
ATTR{idVendor}=="046d", ATTR{idProduct}=="c506", ENV{DKP_PRODUCT}="MX700 Optical Mouse", ENV{DKP_BATTERY_TYPE}="mouse"
|
||||
ATTR{idVendor}=="046d", ATTR{idProduct}=="c508", ENV{DKP_PRODUCT}="Optical TrackMan", ENV{DKP_BATTERY_TYPE}="mouse"
|
||||
ATTR{idVendor}=="046d", ATTR{idProduct}=="c50e", ENV{DKP_PRODUCT}="MX1000 Laser Mouse", ENV{DKP_BATTERY_TYPE}="mouse"
|
||||
ATTR{idVendor}=="046d", ATTR{idProduct}=="c510", ENV{DKP_PRODUCT}="Click! Mouse", ENV{DKP_BATTERY_TYPE}="mouse"
|
||||
ATTR{idVendor}=="046d", ATTR{idProduct}=="c512", ENV{DKP_PRODUCT}="Keyboard+Mouse Receiver", ENV{DKP_BATTERY_TYPE}="keyboard"
|
||||
ATTR{idVendor}=="046d", ATTR{idProduct}=="c702", ENV{DKP_PRODUCT}="Presenter", ENV{DKP_BATTERY_TYPE}="mouse"
|
||||
|
||||
LABEL="dkp_csr_end"
|
||||
|
||||
|
|
|
|||
|
|
@ -3,13 +3,13 @@
|
|||
#
|
||||
SUBSYSTEM!="usb", GOTO="dkp_hid_end"
|
||||
|
||||
ATTR{idVendor}=="0463", ENV{ID_VENDOR}="MGE Systems"
|
||||
ATTR{idVendor}=="051d", ENV{ID_VENDOR}="APC"
|
||||
ATTR{idVendor}=="0764", ENV{ID_VENDOR}="CyberPower"
|
||||
ATTR{idVendor}=="09ae", ENV{ID_VENDOR}="Tripp Lite"
|
||||
ATTR{idVendor}=="050d", ENV{ID_VENDOR}="Belkin"
|
||||
ATTR{idVendor}=="06da", ENV{ID_VENDOR}="Liebert"
|
||||
ATTR{idVendor}=="0925", ENV{ID_VENDOR}="Kebo"
|
||||
ATTR{idVendor}=="0463", ENV{DKP_VENDOR}="MGE Systems"
|
||||
ATTR{idVendor}=="051d", ENV{DKP_VENDOR}="APC"
|
||||
ATTR{idVendor}=="0764", ENV{DKP_VENDOR}="CyberPower"
|
||||
ATTR{idVendor}=="09ae", ENV{DKP_VENDOR}="Tripp Lite"
|
||||
ATTR{idVendor}=="050d", ENV{DKP_VENDOR}="Belkin"
|
||||
ATTR{idVendor}=="06da", ENV{DKP_VENDOR}="Liebert"
|
||||
ATTR{idVendor}=="0925", ENV{DKP_VENDOR}="Kebo"
|
||||
|
||||
# MGE UPS SYSTEMS
|
||||
ATTR{idVendor}=="0463", ATTR{idProduct}=="0001", ENV{DKP_BATTERY_TYPE}="ups"
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
##############################################################################################################
|
||||
# Watts Up? Pro Devices
|
||||
#
|
||||
SUBSYSTEM=="tty", SUBSYSTEMS=="usb", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", ATTRS{serial}=="A80?????", ENV{ID_VENDOR}="Watts Up, Inc.", ENV{ID_PRODUCT}="Watts Up? Pro", ENV{DKP_MONITOR_TYPE}="wup"
|
||||
SUBSYSTEM=="tty", SUBSYSTEMS=="usb", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", ATTRS{serial}=="A80?????", ENV{DKP_VENDOR}="Watts Up, Inc.", ENV{DKP_PRODUCT}="Watts Up? Pro", ENV{DKP_MONITOR_TYPE}="wup"
|
||||
|
||||
|
|
|
|||
|
|
@ -135,6 +135,8 @@ dkp_csr_coldplug (DkpDevice *device)
|
|||
gboolean ret = FALSE;
|
||||
const gchar *type;
|
||||
const gchar *native_path;
|
||||
const gchar *vendor;
|
||||
const gchar *product;
|
||||
|
||||
/* detect what kind of device we are */
|
||||
d = dkp_device_get_d (device);
|
||||
|
|
@ -180,9 +182,18 @@ dkp_csr_coldplug (DkpDevice *device)
|
|||
csr->priv->is_dual = devkit_device_get_property_as_boolean (d, "DKP_CSR_DUAL");
|
||||
egg_debug ("is_dual=%i", csr->priv->is_dual);
|
||||
|
||||
/* prefer DKP names */
|
||||
vendor = devkit_device_get_property (d, "DKP_VENDOR");
|
||||
if (vendor == NULL)
|
||||
vendor = devkit_device_get_property (d, "ID_VENDOR");
|
||||
product = devkit_device_get_property (d, "DKP_PRODUCT");
|
||||
if (product == NULL)
|
||||
product = devkit_device_get_property (d, "ID_PRODUCT");
|
||||
|
||||
/* hardcode some values */
|
||||
g_object_set (device,
|
||||
"vendor", devkit_device_get_property (d, "ID_VENDOR"),
|
||||
"model", devkit_device_get_property (d, "ID_PRODUCT"),
|
||||
"vendor", vendor,
|
||||
"model", product,
|
||||
"power-supply", FALSE,
|
||||
"is-present", TRUE,
|
||||
"is-rechargeable", TRUE,
|
||||
|
|
|
|||
|
|
@ -290,6 +290,7 @@ dkp_hid_coldplug (DkpDevice *device)
|
|||
gboolean ret = FALSE;
|
||||
const gchar *device_file;
|
||||
const gchar *type;
|
||||
const gchar *vendor;
|
||||
|
||||
/* detect what kind of device we are */
|
||||
d = dkp_device_get_d (device);
|
||||
|
|
@ -322,13 +323,18 @@ dkp_hid_coldplug (DkpDevice *device)
|
|||
goto out;
|
||||
}
|
||||
|
||||
/* prefer DKP names */
|
||||
vendor = devkit_device_get_property (d, "DKP_VENDOR");
|
||||
if (vendor == NULL)
|
||||
vendor = devkit_device_get_property (d, "ID_VENDOR");
|
||||
|
||||
/* hardcode some values */
|
||||
g_object_set (device,
|
||||
"type", DKP_DEVICE_TYPE_UPS,
|
||||
"is-rechargeable", TRUE,
|
||||
"power-supply", TRUE,
|
||||
"is-present", TRUE,
|
||||
"vendor", devkit_device_get_property (d, "ID_VENDOR"),
|
||||
"vendor", vendor,
|
||||
"has-history", TRUE,
|
||||
"has-statistics", TRUE,
|
||||
NULL);
|
||||
|
|
|
|||
|
|
@ -302,6 +302,8 @@ dkp_wup_coldplug (DkpDevice *device)
|
|||
const gchar *type;
|
||||
const gchar *native_path;
|
||||
gchar *data;
|
||||
const gchar *vendor;
|
||||
const gchar *product;
|
||||
|
||||
/* detect what kind of device we are */
|
||||
d = dkp_device_get_d (device);
|
||||
|
|
@ -351,6 +353,14 @@ dkp_wup_coldplug (DkpDevice *device)
|
|||
dkp_wup_parse_command (wup, data);
|
||||
g_free (data);
|
||||
|
||||
/* prefer DKP names */
|
||||
vendor = devkit_device_get_property (d, "DKP_VENDOR");
|
||||
if (vendor == NULL)
|
||||
vendor = devkit_device_get_property (d, "ID_VENDOR");
|
||||
product = devkit_device_get_property (d, "DKP_PRODUCT");
|
||||
if (product == NULL)
|
||||
product = devkit_device_get_property (d, "ID_PRODUCT");
|
||||
|
||||
/* hardcode some values */
|
||||
native_path = devkit_device_get_native_path (d);
|
||||
g_object_set (device,
|
||||
|
|
@ -358,8 +368,8 @@ dkp_wup_coldplug (DkpDevice *device)
|
|||
"is-rechargeable", FALSE,
|
||||
"power-supply", FALSE,
|
||||
"is-present", FALSE,
|
||||
"vendor", devkit_device_get_property (d, "ID_VENDOR"),
|
||||
"model", devkit_device_get_property (d, "ID_PRODUCT"),
|
||||
"vendor", vendor,
|
||||
"model", product,
|
||||
"serial", g_strstrip (sysfs_get_string (native_path, "serial")),
|
||||
"has-history", TRUE,
|
||||
"state", DKP_DEVICE_STATE_DISCHARGING,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue