I have been working with many HATs along with Raspberry Pi such as Sense HAT, Pimoroni Enviro pHAT; and so on. However, HATs report its existence to the device tree in /proc/device-tree/hat
and /sys/firmware/devicetree/base/hat
(see details from here). I could extract few information (such as product, vendor; and so on) that were answered in that Q/A. I could enlist the list of sensors (i.e temperature, pressure, humidity; and so on) available on a HAT from vendor/manufacturer end (through website/guidelines) manually. The complexity increases as the number of HATs increases. Anyway, is it possible to read these information (list of available sensors on a HAT) either from PROM / EPROM / EEPROM?
Asked
Active
Viewed 203 times
1

testuser
- 85
- 1
- 2
- 10
1 Answers
3
There is nothing in HAT requirements about supplying a machine-readable list of sensors. Therefore, there is no generic methods to list sensors on a HAT: even if such a method exists, it will be manufacturer-specific at best and HAT-unique at worst.
HAT EEPROM contains either a device tree overlay or a name of such overlay in an external file. See if parsing that gives you the information you need (though it's far from a "list of sensors").

Dmitry Grigoryev
- 27,928
- 6
- 53
- 144
-
1In addition: There are Hats that don't even have an EEPROM module on them. – PMF Apr 26 '20 at 08:52
-
3
-
Are you suggesting to make an API to enlist the available sensors? For example, Sense HAT has six different sensors: 1) Temperature, 2) Humidity, 3) Pressure, 4) Accelerometer, 5) Magnetometer; and 6) Gyroscope. – testuser Apr 28 '20 at 07:19
How many sensors a HAT has on it and what are those?
andCould we enlist those sensors by reading the PROM / EPROM / EEPROM or DEVICE-TREE or manufacturer's API once the HAT (SenseHAT, or pHAT or whatever) determined?
– testuser Apr 23 '20 at 15:55