Do ADC filenames ever change, if so when?

I have a BBB running Debian GNU/Linux 7, 3.8.13-bone47 kernel. I.e.
pretty standard.

My raw ADC files are to be found at:-

    /sys/devices/ocp.3/44e0d000.tscadc/tiadc/iio:device0/in_voltage0_raw
    /sys/devices/ocp.3/44e0d000.tscadc/tiadc/iio:device0/in_voltage1_raw
    /sys/devices/ocp.3/44e0d000.tscadc/tiadc/iio:device0/in_voltage2_raw
    /sys/devices/ocp.3/44e0d000.tscadc/tiadc/iio:device0/in_voltage3_raw
    /sys/devices/ocp.3/44e0d000.tscadc/tiadc/iio:device0/in_voltage4_raw
    /sys/devices/ocp.3/44e0d000.tscadc/tiadc/iio:device0/in_voltage5_raw
    /sys/devices/ocp.3/44e0d000.tscadc/tiadc/iio:device0/in_voltage6_raw
    /sys/devices/ocp.3/44e0d000.tscadc/tiadc/iio:device0/in_voltage7_raw

Currently I use a find() function written in python which walks the
/sys/devices tree to find these files, but it's very slow. If I hard
code the file names how often, if at all, will they need changing?

... and/or is there an easier way to find them, i.e. is there a
configuration file somewhere that tells me where they are (or at least
the non-constant bits of the path)?

You should also see them here:

https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/ABI/testing/sysfs-bus-iio#n91

What: /sys/bus/iio/devices/iio:deviceX/in_voltageY-voltageZ_raw
KernelVersion: 2.6.35
Contact: linux-iio@vger.kernel.org
Description:
Raw (unscaled) differential voltage measurement equivalent to
channel Y - channel Z where these channel numbers apply to the
physically equivalent inputs when non differential readings are
separately available. In differential only parts, then all that
is required is a consistent labeling. Units after application
of scale and offset are millivolts.

Regards,

That isn't really what I was asking for Robert.

Yes, the above tells me how the directory name is generated but I
don't think it gives me a clue what its actual value is for any
particular case. If it *does* tell me how to work out (by program)
the directory name can you explain how to do it please.

I want to either hard-code the address in my Python program (if it's
not likely to change) or I want somewhere *in the BBB* where I can
find the address so the Python program can get it quickly.

It's easy enough for me to find the full directory path to the values
I want (using 'find' or whatever) but I want an efficient programmatic
way of doing it - or I want to know that it isn't going to change and
thus I can hard-code it.

Actually it was...

Walk:

/sys/bus/iio/devices/iio*

Regards,

You can get one name here:

root@beaglebone:~# cat /sys/bus/iio/devices/iio\:device0/name
tiadc

but "device0" should also be set-able somewhere..

Regards,

Well, very nearly! :slight_smile:

If I 'cd /sys/bus/iio/devices/iio*' I get to '/sys/bus/iio/devices/iio:device0',
is there any way of knowing that it's 'iio:device0'? It's still sort
of clumsy doing a Python walk to find the files.

>>> > I have a BBB running Debian GNU/Linux 7, 3.8.13-bone47 kernel. I.e.
>>> > pretty standard.
>>> >
>>> > My raw ADC files are to be found at:-
>>> >
>>> > /sys/devices/ocp.3/44e0d000.tscadc/tiadc/iio:device0/in_voltage0_raw
>>> > /sys/devices/ocp.3/44e0d000.tscadc/tiadc/iio:device0/in_voltage1_raw
>>> > /sys/devices/ocp.3/44e0d000.tscadc/tiadc/iio:device0/in_voltage2_raw
>>> > /sys/devices/ocp.3/44e0d000.tscadc/tiadc/iio:device0/in_voltage3_raw
>>> > /sys/devices/ocp.3/44e0d000.tscadc/tiadc/iio:device0/in_voltage4_raw
>>> > /sys/devices/ocp.3/44e0d000.tscadc/tiadc/iio:device0/in_voltage5_raw
>>> > /sys/devices/ocp.3/44e0d000.tscadc/tiadc/iio:device0/in_voltage6_raw
>>> > /sys/devices/ocp.3/44e0d000.tscadc/tiadc/iio:device0/in_voltage7_raw
>>> >
>>> > Currently I use a find() function written in python which walks the
>>> > /sys/devices tree to find these files, but it's very slow. If I hard
>>> > code the file names how often, if at all, will they need changing?
>>> >
>>> > ... and/or is there an easier way to find them, i.e. is there a
>>> > configuration file somewhere that tells me where they are (or at least
>>> > the non-constant bits of the path)?
>>>
>>> You should also see them here:
>>>
>>> https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/ABI/testing/sysfs-bus-iio#n91

>>>
>>>
>>> What: /sys/bus/iio/devices/iio:deviceX/in_voltageY-voltageZ_raw
>>> KernelVersion: 2.6.35
>>> Contact: linux-iio@vger.kernel.org
>>> Description:
>>> Raw (unscaled) differential voltage measurement equivalent to
>>> channel Y - channel Z where these channel numbers apply to the
>>> physically equivalent inputs when non differential readings are
>>> separately available. In differential only parts, then all that
>>> is required is a consistent labeling. Units after application
>>> of scale and offset are millivolts.
>>>
>> That isn't really what I was asking for Robert.
>
> Actually it was...
>
> Walk:
>
> /sys/bus/iio/devices/iio*

You can get one name here:

root@beaglebone:~# cat /sys/bus/iio/devices/iio\:device0/name
tiadc

What I want though is the names of the files with the values in, i.e.:-

    /sys/bus/iio/devices/iio:device0/in_voltage0_raw

but "device0" should also be set-able somewhere..

I don't want to set it, I just want to know its value! :slight_smile:

Thanks though, you've taken me to a much faster way of finding the
files at least.

well the "tscadc" label:

https://github.com/beagleboard/linux/blob/3.8/firmware/capes/BB-ADC-00A0.dts#L37

is here:

root@beaglebone:~# cat /sys/bus/iio/devices/iio\:device0/name
tiadc

Regards,