Add support for HID devices.

git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5786 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
Jean Delvare committed 2009-10-18 12:05:16 +00:00
1 parent f5fc77eb58
commit 7c37bd44ac
6 files changed
+25 -2

No files matched your search

+1
View File
@@ -3,6 +3,7 @@ lm-sensors CHANGES file
SVN-HEAD
libsensors: Support upcoming sysfs path to i2c adapters
Add support for HID devices
fancontrol: Check that all referenced sysfs files exist
Check that all devices match the configuration file
pwmconfig: Exit immediately if not root
+4
View File
@@ -6,6 +6,10 @@ over time. This document summarizes these evolutions so that application
authors can quickly figure out how to test for the availability of a
given new feature.
0x421 lm-sensors SVN
* Added bus type "hid":
#define SENSORS_BUS_TYPE_HID
0x420 lm-sensors 3.1.1
* Added a method to free the memory allocated by sensors_parse_chip_name()
void sensors_free_chip_name(sensors_chip_name *chip);
+4
View File
@@ -363,6 +363,10 @@ const char *sensors_get_adapter_name(const sensors_bus_id *bus)
return "Virtual device";
case SENSORS_BUS_TYPE_ACPI:
return "ACPI interface";
/* HID should probably not be there either, but I don't know if
HID buses have a name nor where to find it. */
case SENSORS_BUS_TYPE_HID:
return "HID adapter";
}
/* bus types with several instances */
+6
View File
@@ -121,6 +121,8 @@ int sensors_parse_chip_name(const char *name, sensors_chip_name *res)
res->bus.type = SENSORS_BUS_TYPE_VIRTUAL;
else if (!strncmp(name, "acpi", dash - name))
res->bus.type = SENSORS_BUS_TYPE_ACPI;
else if (!strncmp(name, "hid", dash - name))
res->bus.type = SENSORS_BUS_TYPE_HID;
else
goto ERROR;
name = dash + 1;
@@ -131,6 +133,7 @@ int sensors_parse_chip_name(const char *name, sensors_chip_name *res)
switch (res->bus.type) {
case SENSORS_BUS_TYPE_I2C:
case SENSORS_BUS_TYPE_SPI:
case SENSORS_BUS_TYPE_HID:
if (!strncmp(name, "*-", 2)) {
res->bus.nr = SENSORS_BUS_NR_ANY;
name += 2;
@@ -187,6 +190,9 @@ int sensors_snprintf_chip_name(char *str, size_t size,
case SENSORS_BUS_TYPE_ACPI:
return snprintf(str, size, "%s-acpi-%x", chip->prefix,
chip->addr);
case SENSORS_BUS_TYPE_HID:
return snprintf(str, size, "%s-hid-%hd-%x", chip->prefix,
chip->bus.nr, chip->addr);
}
return -SENSORS_ERR_CHIP_NAME;
+2 -1
View File
@@ -31,7 +31,7 @@
when the API + ABI breaks), the third digit is incremented to track small
API additions like new flags / enum values. The second digit is for tracking
larger additions like new methods. */
#define SENSORS_API_VERSION 0x420
#define SENSORS_API_VERSION 0x421
#define SENSORS_CHIP_NAME_PREFIX_ANY NULL
#define SENSORS_CHIP_NAME_ADDR_ANY (-1)
@@ -43,6 +43,7 @@
#define SENSORS_BUS_TYPE_SPI 3
#define SENSORS_BUS_TYPE_VIRTUAL 4
#define SENSORS_BUS_TYPE_ACPI 5
#define SENSORS_BUS_TYPE_HID 6
#define SENSORS_BUS_NR_ANY (-1)
#define SENSORS_BUS_NR_IGNORE (-2)
+8 -1
View File
@@ -518,7 +518,7 @@ static int sensors_read_one_sysfs_chip(const char *dev_path,
const char *dev_name,
const char *hwmon_path)
{
int domain, bus, slot, fn;
int domain, bus, slot, fn, vendor, product, id;
int err = -SENSORS_ERR_KERNEL;
char *bus_attr;
char bus_path[NAME_MAX];
@@ -612,6 +612,13 @@ static int sensors_read_one_sysfs_chip(const char *dev_path,
/* For now we assume that acpi devices are unique */
entry.chip.bus.nr = 0;
entry.chip.addr = 0;
} else
if (subsys && !strcmp(subsys, "hid") &&
sscanf(dev_name, "%x:%x:%x.%x", &bus, &vendor, &product, &id) == 4) {
entry.chip.bus.type = SENSORS_BUS_TYPE_HID;
/* As of kernel 2.6.32, the hid device names don't look good */
entry.chip.bus.nr = bus;
entry.chip.addr = id;
} else {
/* Ignore unknown device */
err = 0;