lkml.org 
[lkml]   [2008]   [Nov]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: hid class and sysfs/hwmon
On 11/08/2008 07:18 AM, Adam Nielsen wrote:
> Here is the code so far, if it's useful: (I've omitted all the error
> checking code for clarity, all the functions called here return success)
>
> --------------------------------------------
> static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_temp, NULL, 0);
>
> static struct attribute *odin_attributes[] = {
> &sensor_dev_attr_temp1_input.dev_attr.attr,
> NULL
> };
>
> static const struct attribute_group odin_attr_group = {
> .attrs = odin_attributes,
> };
>
> static int odin_probe(struct hid_device *hdev,
> const struct hid_device_id *id)
> {
> hid_parse(hdev);
> hid_hw_start(hdev, HID_CONNECT_DEFAULT);
>
> odin_psu = kzalloc(sizeof(struct odin_psu_device), GFP_KERNEL);
> odin_psu->hdev = hdev;
>
> hid_set_drvdata(hdev, odin_psu);
>
> sysfs_create_group(&hdev->dev.kobj, &odin_attr_group);
> odin_psu->hwmon_dev = hwmon_device_register(&hdev->dev);
>
> return 0;
> }
> --------------------------------------------
> If anyone can see why this might result in no sysfs files, please let me
> know! I previously had most of this code working with a platform_device
> instead of the hid_device, which is what makes me wonder about
> hdev->dev.kobj. (Not sure how to test if that variable is accurate,
> either.) Or perhaps it has already been used elsewhere and it can only
> be used once?

I suppose it's under /sys/bus/hid/devices/.../, isn't it?


\
 
 \ /
  Last update: 2008-11-08 15:19    [W:0.046 / U:1.420 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site