# locate devices created by a kernel module? [SOLVED]

## mikegpitt

Is there a command or and area inside the filesystem where I can determine the device(s) a specific kernel module created?

Here's the situation, I'm working with an experimental kernel driver that is creating a few devices that should give me access to some hardware features.  The module loads correctly through udev, and I can see some entries under /sys for the corresponding devices, however, I have no understanding how I can properly access these devices and query them for information.

For example, one of the drivers is an accellerometer, and I would like to query the device for axis data, and I have no idea what device is created and where I can access its corresponding data.

Any help is appreciated!

EDIT:  Ironically, right after I posted this I found one of the input devices I was looking for (in this case /dev/input/input10 by scrounging around in /sys.  I'm still wondering if there is an easier / better way to find out this information.Last edited by mikegpitt on Fri Mar 05, 2010 11:31 pm; edited 1 time in total

----------

## Link31

Try the lshal command. Look for the "info.product" and "linux.device_file" entries.

Then you can write a simple script to automatically retrieve the device file, such as :

```
product_name="ThinkPad HDAPS accelerometer data"

hal-get-property --udi $(hal-find-by-property --key info.product --string "$product_name") --key linux.device_file
```

Of course, HAL is required.

In order to read the axis data, I think you need to open the device using some input-related API. However, your accelerometer driver may provide an easier way to directly read the data, on Thinkpads it is located at /sys/devices/platform/hdaps/position.

----------

## mikegpitt

Thanks for your comments...  you are correct, the information is listed in lshal.

As for the accelerometer, this isn't a Thinkpad version, and since it's pretty experimental there isn't much documentation beyond the kernel source.  This particular driver is hooked into the ACPI subsystem.  Is it possible to query such devices through ACPI for information?

----------

## Link31

I'm not sure what "querying ACPI" would mean in practice... But you can read some ACPI events either with lshal -m or with the acpid program. Though I can't imagine how ACPI events could encode accelerometer data...

Can't you simply look in the source code of this particular driver, assuming it is open-source ?

----------

## mikegpitt

I was incorrect about it using ACPI to detect events... everything seems to be fed through the input.h API, which I can access by writing a small program to interpret the events.  Problem solved for now   :Smile: 

----------

