FDD-book/examples/part-02/ch08-working-with-device-files/userland/devd_watch.sh
Edson Brandi 6e6dac94fe Add book companion files under examples/
Organize companion code and materials by book part:

  part-01/      Foundations
  part-02/      Kernel & driver fundamentals
  part-03/      Character & block devices
  part-04/      Networking & storage
  part-05/      Buses & advanced topics
  part-06/      Debugging & performance
  part-07/      Real-world drivers
  appendices/   Supplementary material
  README.md     Overview and build instructions
2026-04-25 16:51:00 +00:00

19 lines
616 B
Bash
Executable file

#!/bin/sh
#
# devd_watch.sh: subscribe to the devd event stream and print events
# that match the myfirst driver. Used for Chapter 8 Challenge 5 and
# for debugging driver load/unload behavior.
#
# Run in one terminal while you load and unload the driver in another.
# Requires netcat (base system) to connect to devd's socket.
SOCKET=/var/run/devd.seqpacket.pipe
if [ ! -S "${SOCKET}" ]; then
echo "devd socket ${SOCKET} not available" >&2
echo "ensure devd is running (service devd status)" >&2
exit 1
fi
echo "Listening for myfirst events on ${SOCKET}..." >&2
nc -U "${SOCKET}" | grep -i 'myfirst'