STRUCT W1_UART_DEVICE(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

🌸 NAME 🌸

struct w1_uart_device β€” the 1-Wire UART device structure, bestie πŸ’–

okay so like, quick vibe check: this is from the Kernel API Manual, section 9, and it's the little struct that holds literally everything a 1-Wire-over-UART device needs to function. it's giving "main character energy" for the whole driver ngl πŸŽ€


✨ SYNOPSIS ✨

struct w1_uart_device {
    struct serdev_device *serdev;
    struct w1_bus_master bus;
    struct w1_uart_config cfg_reset;
    struct w1_uart_config cfg_touch_0;
    struct w1_uart_config cfg_touch_1;
    struct completion rx_byte_received;
    struct mutex rx_mutex;
    int rx_err;
    u8 rx_byte;
 };

like yes, that's the whole glow-up πŸ’… copy it exactly, no cap.


πŸ¦‹ Members πŸ¦‹

  • serdev β€” the serial device, aka the actual hardware bestie this whole thing rides on 🫢
  • bus β€” the w1-bus master, the icon that runs the 1-Wire show πŸ‘‘
  • cfg_reset β€” the config for a 1-Wire reset ✨
  • cfg_touch_0 β€” the config for a 1-Wire write-0 cycle πŸ’€ (yes, zero, that's not a typo)
  • cfg_touch_1 β€” the config for a 1-Wire write-1 and read cycle 🌈 two jobs, one struct field, we love a multitasker
  • rx_byte_received β€” completion for serdev receive, aka the "omg the byte arrived!!" notification πŸŽ€
  • rx_mutex β€” a mutex to protect rx_err and rx_byte, because sharing is caring but also race conditions are not it πŸ™ˆ
  • rx_err β€” indicates an error in serdev-receive 😭
  • rx_byte β€” the result byte from serdev-receive πŸ“
lowkey important: rx_mutex guards rx_err and rx_byte together. don't be out here touching those two without it, fr fr.

πŸ”₯ SEE ALSO πŸ”₯

  • Kernel file ./drivers/w1/masters/w1-uart.c
  • struct w1_uart_config(9)
  • struct w1_uart_limits(9)

go read those next, iykyk πŸ’œ


and that's the tea, bestie β˜• this page lives under Kernel file ./drivers/w1/masters, dated October 2026 β€” slay, go write some 1-Wire code, periodt πŸ’…βœ¨

πŸ“¦ where this page comes from