[Gta04-owner] QtMoko patch to show pressure from BMP085 device

NeilBrown neilb at suse.de
Wed May 30 23:29:56 CEST 2012


On Wed, 30 May 2012 10:54:46 +0200 Neil Jerram <neil at ossau.homelinux.net>
wrote:

> Christoph Mair <christoph.mair at gmail.com> writes:
> 
> >> root at neo:~# find /sys -name "*pressure*"
> >> /sys/devices/platform/omap/omap_i2c.2/i2c-2/2-0077/pressure0_input
> >> root at neo:~#
> >
> > There should be at least be a /sys/bus/i2c/devices/2-0077/.. (or
> > similar) path too.
> 
> You're right (of course, and as Radek has also found):
> 
> root at neo:~# cat /sys/bus/i2c/drivers/bmp085/2-0077/pressure0_input 
> 92895
> 
> So I've learned something else new: "find" apparently isn't reliable for
> finding everything under /sys.

No.  One of my gripes about sysfs - it isn't easily discoverable.

Possibly best way to find a good name is to start with the 'subsystem' link.

gta04:/# cd /sys/devices/platform/omap_i2c.2/i2c-2/2-0077
gta04:/sys/devices/platform/omap_i2c.2/i2c-2/2-0077# ls -l subsystem
lrwxrwxrwx 1 root root 0 Jan  1 11:03 subsystem -> ../../../../../bus/i2c


so start looking in /sys/bus/i2c.  For 'bus' you need to look in a 'devices'
subdirectory.  For 'class' you don't.

gta04:/sys/devices/platform/omap_i2c.2/i2c-2/2-0077# cd /sys/bus/i2c/devices
gta04:/sys/bus/i2c/devices# ls
1-0048	1-004a	2-0041	2-0048	i2c-1  i2c-3
1-0049	1-004b	2-0045	2-0077	i2c-2

2-0077 looks likely:

gta04:/sys/bus/i2c/devices#  ls -l 2-0077
lrwxrwxrwx 1 root root 0 Jan  1 11:05 2-0077 -> ../../../devices/platform/omap_i2c.2/i2c-2/2-0077
gta04:/sys/bus/i2c/devices#  ls -l 2-0077/.
total 0
lrwxrwxrwx 1 root root    0 Jan  1 11:05 driver -> ../../../../../bus/i2c/drivers/bmp085
-r--r--r-- 1 root root 4096 Jan  1 11:05 modalias
-r--r--r-- 1 root root 4096 Jan  1 11:05 name
-rw-r--r-- 1 root root 4096 Jan  1 11:05 oversampling
drwxr-xr-x 2 root root    0 Jan  1 11:05 power
-r--r--r-- 1 root root 4096 Jan  1 11:05 pressure0_input
lrwxrwxrwx 1 root root    0 Jan  1 11:03 subsystem -> ../../../../../bus/i2c
-r--r--r-- 1 root root 4096 Jan  1 11:05 temp0_input
-rw-r--r-- 1 root root 4096 Jan  1 11:03 uevent

Yes, that is it.  so  
    /sys/bus/i2c/devices/2-0077/pressure0_input

is a canonical name (as has already been discovered).

NeilBrown
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 828 bytes
Desc: not available
URL: <http://lists.goldelico.com/pipermail/gta04-owner/attachments/20120531/2f2be42d/attachment.bin>


More information about the Gta04-owner mailing list