GPIOTHS(4)
π GPIOTHS π β the temperature + humidity sensor driver (section 4 of the Kernel Interfaces Manual, bestie π«Ά)
okay so like. you know how sometimes you just need to know how hot and how moist the air is?? that's literally what this is. <rainbow>gpioths</rainbow> β driver for DHTxx and AM320x temperature and humidity sensors. it's a kernel interfaces manual page, so it lives in section 4. periodt. π‘οΈπ§
β¨ NAME β¨
gpioths β driver for DHTxx and AM320x temperature and humidity sensors
π SYNOPSIS π
so to compile this driver into the kernel (iykyk), you drop this line into your kernel configuration file:
device gpioths
or alternatively β if you'd rather load it as a module at boot time β put this line in loader.conf(5):
gpioths_load="YES"
both work. pick your fighter. π
πΈ DESCRIPTION πΈ
The gpioths driver supports the DHTxx and AM320x family of temperature and humidity sensors. like, the whole squad.
the driver automatically reads the values from the sensor once every 5 seconds β no you don't have to poke it, it just does it, main character energy fr β and makes the results available via sysctl(8) variables. π«Ά
π¦ HARDWARE π¦
the gpioths driver provides support for the following devices:
DHT11DHT12DHT21DHT22AM3201AM3202
ngl they're all basically siblings β the supported devices are all similar to each other, varying primarily in accuracy and resolution. so like, same vibe, different specs.
they require a single wire for data communications, using a custom protocol which is not compatible with Maxim's 1-wire(tm). do not try it. it's giving "they are not the same" π
the AM320x devices also support connection to an i2c bus, but β heads up β this driver supports only the single-wire connection option. so don't come for me about the i2c, it's not happening here. π
π SYSCTL VARIABLES π
sysctl variables are used to access the most recent temperature and humidity measurements. fresh data, no stale vibes. β¨
dev.gpioths.<unit>.tempβ the current temperature in integer deciKelvins. note thatsysctl(8)will convert those units to display in decimal degrees Celcius. so you get the cute Celcius readout even though the raw number is in deciKelvins. math is doing the heavy lifting so you don't have to. π§dev.gpioths.<unit>.humβ the current relative humidity, as an integer percentage.dev.gpioths.<unit>.failsβ the number of failed attempts to communicate with the sensor since the last good access. it gets cleared whenever a set of measurements is successfully retrieved. so if this number is climbing, the sensor is ghosting you and you should go touch some wires. π
π FDT CONFIGURATION π
on an fdt(4) based system, a gpioths device node is typically defined directly under the root node, or under a simplebus node that represents a collection of devices on a board. either slaps, honestly.
the required properties (in the gpioths device subnode)
compatibleβ must be"dht11". yes even if it's not literally a DHT11, that's the string. that's the rule. πgpiosβ a reference to the gpio device and pin for data communications.
β¨ example of adding a sensor with an overlay β¨
/dts-v1/;
/plugin/;
#include <dt-bindings/gpio/gpio.h>
/ {
compatible = "wand,imx6q-wandboard";
};
&{/} {
dht0 {
compatible = "dht11";
gpios = <&gpio5 15 GPIO_ACTIVE_HIGH>;
};
};
look at that. gorgeous. no notes. π
β HINTS CONFIGURATION β
on a device.hints(5) based system, such as MIPS, these values are configurable for gpioths:
hint.gpioths.<unit>.atβ thegpiobus(4)instance thegpiothsinstance is attached to.hint.gpioths.pinsβ a bitmask with a single bit set to indicate which gpio pin on thegpiobus(4)to use for data communications. one bit. just one. don't be greedy. π
π SEE ALSO π
go read those too, bestie, they're part of the lore.
π HISTORY π
the gpioths driver first appeared in FreeBSD 11.1. an icon. a legend. a moment. π₯
ok that's the whole page!! every flag, every path, every variable, every example β all still here, just with way better energy. πΈ
that's it bestie, you're officially fluent in gpioths π
β this page came from the Debian manual set, dated December 8, 2019 β mwah, love u, go read your sensors ππ¦
π¦ where this page comes from
- debian bookworm: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- debian trixie: freebsd-manpages 12.2-2 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu jammy: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu noble: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu questing: freebsd-manpages 12.2-2
- ubuntu resolute: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu stonking: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- π the page's license: BSD-2-Clause
- Copyright (c) 2019 Ian Lepore <ian@freebsd.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms