1

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?

  • 2
    "It would be very easy if there is an automated way." This made me laugh :) – Seamus Apr 23 at 14:39
  • 1
    My point is not that actually for what you have been laughing. The point was that How many sensors a HAT has on it and what are those? and Could 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 at 15:55
  • Yes, sorry - my humor was inappropriate. – Seamus Apr 23 at 15:56
3
+50

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").

| improve this answer | |
  • 1
    In addition: There are Hats that don't even have an EEPROM module on them. – PMF Apr 26 at 8:52
  • 3
    @PMF Those are add-on boards, not HATs. – Dmitry Grigoryev Apr 26 at 12:10
  • 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 at 7:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.