Inspiration
QNX powers real-time systems in cars, medical devices and industrial controllers, and its resource-manager model is how hardware is exposed to applications on QNX. qnx-sensorhub was built to use that native plumbing for real: a virtual-sensor resource manager that exposes sensors as device files, the way real QNX drivers expose hardware.
What it does
qnx-sensorhub is a QNX 8.0-native virtual-sensor resource manager with a client and threshold pulse alerts, built for QNX Hackathon 2026 (category: Low-level Software).
- The
sensorhubdaemon registers two device files:/dev/sensor0(temperature, simulated, with a slow upward drift) and/dev/sensor1(humidity + pressure, simulated). - The
sensorctlclient reads live values, configures the daemon withdevctl()(sampling rate, threshold, stats, reset), and subscribes to the QNX pulse that fires when the temperature crosses a set threshold.
How we built it
Built with QNX SDP 8.0 and the qcc toolchain, targeting QNX 8.0 on QEMU (aarch64, virt machine). It is QNX-native, not a Linux port:
- Resource manager framework (
resmgr_attach,dispatch_create,iofunc_*). devctl()configuration, including a custom subscribe command (__DIOF/__DIOT/__DION).- QNX pulses for event notification (server → client channel via
ConnectAttach(_NTO_SIDE_CHANNEL)). - A POSIX timer delivering a pulse into the dispatch loop.
- Packaged into a bootable IFS with
mkifsand run under QEMU (TCG, no KVM needed). A smallshim5.elfis needed because QEMU's ELF-kernel loader doesn't pass the DTB inx0; the shim setsx0to the DTB at the top of RAM and jumps to the IFS entry point.
Requirements: QNX SDP 8.0 installed via QNX Software Center (a non-commercial/academic licence is enough), host qemu-system-aarch64 (8.x), and a Linux or QNX host with the SDP 8.0 toolchain on PATH.
Build:
source <sdp-install>/qnxsdp-env.sh # sets QNX_HOST, QNX_TARGET
make -C build # aarch64 (QEMU virt); or make ARCH=x86_64
# minimal /bin/sleep helper (the SDP target tree ships no sleep/echo):
qcc -Vgcc_ntoaarch64le -O2 -o out/aarch64/sleep src/sleep.c
scripts/build-ifs.sh # -> out/aarch64/sensorhub.ifs
Rebuild the shim after any IFS change (from out/aarch64/, with the SDP environment sourced):
as shim5.s -o shim5.o && ld -T shim5.ld shim5.o -o shim5.elf
Run (QEMU):
scripts/boot-qemu.sh # 256 MB guest, console on stdio
The IFS .script runs an auto-test on boot (starts sensorhub, reads both devices, changes the rate to 100 ms, fires the threshold pulse, prints stats), then drops to a ksh shell. From the shell:
sensorhub &
echo /dev/sensor* # devices are up (no /bin/ls in the image)
sensorctl # 10 live readings
sensorctl -s # daemon stats
sensorctl -r 200 # sampling rate -> 200 ms
sensorctl -t 23 -S # threshold 23C, wait for the pulse
sensorctl options: -d device (default /dev/sensor0), -n count (default 10), -r rate_ms (set sampling rate), -t thresh_C (set threshold), -s print stats, -R reset stats, -S subscribe to the threshold pulse and wait.
Accomplishments that we're proud of
Verified 2026-11-16: built with SDP 8.0 (qcc aarch64), IFS 2,662,468 bytes, booted under QEMU 8.2.2 TCG (-machine virt -cpu cortex-a57 -m 256). The auto-test passes: live readings (temperature ~22.00C, humidity ~44.5%, pressure ~1013.07 hPa), devctl SET_RATE to 100 ms confirmed, threshold pulse fired (THRESHOLD CROSSED: temp=23.13C), stats reads=7 devctls=4 pulses=1 rate=100ms threshold=23.00C. The demo video (92.3 s, 1080p) shows the full flow.
What we learned
How QNX resource managers, devctl(), pulses and channels fit together, and how to build a bootable IFS with mkifs and boot it under QEMU. Along the way: the [search] paths in build/sensorhub.build point at the SDP install used here and need adjusting for another machine; the runtime linker is a real ldqnx-64.so.2 binary (not a symlink to libc.so.6); the SDP 8.0 target tree ships no /bin/ls, so the image uses ksh globbing; startup-qemu-virt is the BSP startup binary for QEMU virt (aarch64); and the image address is 0x40200000.
Repository: https://github.com/real0xSI/qnx-sensorhub (MIT licence).
Built With
- c
- qemu
- qnx