Changeset 5786

Show
Ignore:
Timestamp:
10/18/09 14:05:16 (5 years ago)
Author:
khali
Message:

Add support for HID devices.

Location:
lm-sensors/trunk
Files:
6 modified

Legend:

Unmodified
Added
Removed
  • lm-sensors/trunk/CHANGES

    r5784 r5786  
    44SVN-HEAD 
    55  libsensors: Support upcoming sysfs path to i2c adapters 
     6              Add support for HID devices 
    67  fancontrol: Check that all referenced sysfs files exist 
    78              Check that all devices match the configuration file 
  • lm-sensors/trunk/doc/libsensors-API.txt

    r5740 r5786  
    66authors can quickly figure out how to test for the availability of a 
    77given new feature. 
     8 
     90x421   lm-sensors SVN 
     10* Added bus type "hid": 
     11  #define SENSORS_BUS_TYPE_HID 
    812 
    9130x420   lm-sensors 3.1.1 
  • lm-sensors/trunk/lib/access.c

    r5748 r5786  
    364364        case SENSORS_BUS_TYPE_ACPI: 
    365365                return "ACPI interface"; 
     366        /* HID should probably not be there either, but I don't know if 
     367           HID buses have a name nor where to find it. */ 
     368        case SENSORS_BUS_TYPE_HID: 
     369                return "HID adapter"; 
    366370        } 
    367371 
  • lm-sensors/trunk/lib/data.c

    r5740 r5786  
    122122        else if (!strncmp(name, "acpi", dash - name)) 
    123123                res->bus.type = SENSORS_BUS_TYPE_ACPI; 
     124        else if (!strncmp(name, "hid", dash - name)) 
     125                res->bus.type = SENSORS_BUS_TYPE_HID; 
    124126        else 
    125127                goto ERROR; 
     
    132134        case SENSORS_BUS_TYPE_I2C: 
    133135        case SENSORS_BUS_TYPE_SPI: 
     136        case SENSORS_BUS_TYPE_HID: 
    134137                if (!strncmp(name, "*-", 2)) { 
    135138                        res->bus.nr = SENSORS_BUS_NR_ANY; 
     
    188191                return snprintf(str, size, "%s-acpi-%x", chip->prefix, 
    189192                                chip->addr); 
     193        case SENSORS_BUS_TYPE_HID: 
     194                return snprintf(str, size, "%s-hid-%hd-%x", chip->prefix, 
     195                                chip->bus.nr, chip->addr); 
    190196        } 
    191197 
  • lm-sensors/trunk/lib/sensors.h

    r5740 r5786  
    3232   API additions like new flags / enum values. The second digit is for tracking 
    3333   larger additions like new methods. */ 
    34 #define SENSORS_API_VERSION             0x420 
     34#define SENSORS_API_VERSION             0x421 
    3535 
    3636#define SENSORS_CHIP_NAME_PREFIX_ANY    NULL 
     
    4444#define SENSORS_BUS_TYPE_VIRTUAL        4 
    4545#define SENSORS_BUS_TYPE_ACPI           5 
     46#define SENSORS_BUS_TYPE_HID            6 
    4647#define SENSORS_BUS_NR_ANY              (-1) 
    4748#define SENSORS_BUS_NR_IGNORE           (-2) 
  • lm-sensors/trunk/lib/sysfs.c

    r5759 r5786  
    519519                                       const char *hwmon_path) 
    520520{ 
    521         int domain, bus, slot, fn; 
     521        int domain, bus, slot, fn, vendor, product, id; 
    522522        int err = -SENSORS_ERR_KERNEL; 
    523523        char *bus_attr; 
     
    613613                entry.chip.bus.nr = 0; 
    614614                entry.chip.addr = 0; 
     615        } else 
     616        if (subsys && !strcmp(subsys, "hid") && 
     617            sscanf(dev_name, "%x:%x:%x.%x", &bus, &vendor, &product, &id) == 4) { 
     618                entry.chip.bus.type = SENSORS_BUS_TYPE_HID; 
     619                /* As of kernel 2.6.32, the hid device names don't look good */ 
     620                entry.chip.bus.nr = bus; 
     621                entry.chip.addr = id; 
    615622        } else { 
    616623                /* Ignore unknown device */