STRUCT W1_BUS_MASTER(9)
Okay bestie, welcome to struct w1_bus_master(9) from the Kernel API Manual β¨. This is the whole ops vibe for a bus master, and weβre gonna go through every single member together, no skips, fr fr π.
β¨ NAME β¨
struct w1_bus_master β operations available on a bus master. Thatβs the glow-up: itβs the set of operations you get on a bus master, periodt π.
πΈ SYNOPSIS πΈ
Hereβs the struct in all its iconic form β copy it exactly, bestie:
struct w1_bus_master {
void *data;
u8 (*read_bit)(void *);
void (*write_bit)(void *, u8);
u8 (*touch_bit)(void *, u8);
u8 (*read_byte)(void *);
void (*write_byte)(void *, u8);
u8 (*read_block)(void *, u8 *, int);
void (*write_block)(void *, const u8 *, int);
u8 (*triplet)(void *, u8);
u8 (*reset_bus)(void *);
u8 (*set_pullup)(void *, int);
void (*search)(void *, struct w1_master *, u8,
w1_slave_found_callback);
char *dev_id;
};
π Members π
dataβ the first parameter in all the functions below. The main-character pointer, basically π«Ά.read_bitβ sample the line level, then return the level read (0or1).write_bitβ sets the line level.touch_bitβ the lowest-level function for devices that really support the 1-wire protocol.touch_bit(0)= write-0 cycle;touch_bit(1)= write-1 / read cycle; return the bit read (0or1).read_byteβ reads a byte. Same as 8touch_bit(1)calls. Return the byte read.write_byteβ writes a byte. Same as 8touch_bit(x)calls.read_blockβ same as a series ofread_bytecalls; return the number of bytes read.write_blockβ same as a series ofwrite_bytecalls.tripletβ combines two reads and a smart write for ROM searches; returnbit0=Id,bit1=comp_id,bit2=dir_taken.reset_busβ long write-0 with a read for the presence pulse detection; return-1=Error,0=Device present,1=No device present.set_pullupβ put out a strong pull-up pulse of the specified duration; return-1=Error,0=completed.searchβ really nice hardware can handle the different types of ROM search.w1_master*is passed to the slave found callback. Theu8issearch_type,W1_SEARCHorW1_ALARM_SEARCH.dev_idβ optional device id string, which w1 slaves could use for creating names, which then give a connection to the w1 master.
β οΈ Note β οΈ
read_bit and write_bit are very low level functions and should only be used with hardware that doesnβt really support 1-wire operations, like a parallel/serial port. Either define read_bit and write_bit OR define, at minimum, touch_bit and reset_bus. No cap, thatβs the rule π.
π SEE ALSO π
Kernel file ./include/linux/w1.h:
struct w1_reg_num(9)struct w1_slave(9)enum w1_master_flags(9)struct w1_master(9)struct w1_family_ops(9)struct w1_family(9)module_w1_family(9)
Signed off with love from ./include/linux β October 2026 β struct w1_bus_master(9) ππ¦β¨
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms