OWN(9)
okay bestie, sit down, hydrate, put your phone on do-not-disturb, because we are reading own(9) β the page out of the Kernel Developer's Manual about the Dallas Semiconductor 1-Wire Network and Transport Interface. it's giving kernel plumbing but make it fashion β¨ no cap, this one's actually cute once you get past the first paragraph.
π NAME π
own, own_send_command, own_commmand_wait, own_self_command, own_acquire_bus, own crc, own_release_bus, OWN_ACQUIRE_BUS, OWN_CRC, OWN_RELEASE_BUS, OWN_SEND_COMMAND β that's the whole squad right there, the Dallas Semiconductor 1-Wire Network and Transport Interface.
and yes, <hotpink>we keep the spelling exactly as it is</hotpink>: own crc has a literal space in it, and own_commmand_wait really does have three m's. we do not fix the manpage. we love the manpage π«Ά
π SYNOPSIS π
#include <sys/bus.h>
#include <dev/ow/own.h>
int
own_send_command(device_t pdev, struct ow_cmd *cmd);
int
own_command_wait(device_t pdev, struct ow_cmd *cmd);
int
own_self_command(device_t pdev, struct ow_cmd *cmd, uint8_t xpt_cmd);
int
own_acquire_bus(device_t pdev, int how);
int
own_release_bus(device_t pdev);
int
own_crc(device_t pdev, uint8_t *buffer, size_t len);
int
OWN_SEND_COMMAND(device_t ndev, device_t pdev, struct ow_cmd *cmd);
int
OWN_ACQUIRE_BUS(device_t ndev, device_t pdev, int how);
void
OWN_RELEASE_BUS(device_t ndev, device_t pdev);
uint8_t
OWN_CRC(device_t ndev, device_t pdev, uint8_t *buffer, size_t len);
π DESCRIPTION π
so the own interface is basically three little friend groups of functions, all here to help you talk to 1-Wire devices:
- sending commands π¨
- reserving the bus π
- making sure your data isn't lying to you π΅οΈ
the wrappers exist for the raw OWN kobj(9) interfaces, and bestie, you should use the wrappers β they're the safer ones. the kobj(9) ones are the feral versions. use the wrappers, fr fr.
π Bus Commands π
the 1-Wire bus has layers of access to the devices sitting on it (very onion, very shrek). the own functions hand you the network layer and the transport layer.
- the network layer decides whether the next command is for every device on the bus, or for one specific device. it also says what speed the link layer should use. main character decisions.
struct ow_cmdis the little container that holds network access, speed, and timing info. it says what commands to send and whether or not we're reading data back. its members are:flagsβ flags that control how the structure gets interpreted. these are defined in<dev/ow/ow.h>:OW_FLAG_OVERDRIVEβ sendxpt_cmdbytes and readxpt_readbytes at overdrive speed. zoom zoom ποΈOW_FLAG_READ_BITβ interpretxpt_read_lenas bits to be read afterxpt_cmd, instead of bytes.
rom_cmdβ the ROM command bytes to send.rom_lenβ how many ROM command bytes to send.rom_read_lenβ how many bytes to read after sending the ROM command.rom_readβ the buffer for the bytes read after the ROM command.xpt_cmdβ the transport command to send.xpt_lenβ the length of the transport command bytes to send. pass0if there's no transport command, bestie, it's fine.xpt_read_lenβ how many bytes to read after thexpt_cmdbytes go out. but ifOW_FLAG_READ_BITis set inflags, then this is the number of bits to read. bits get packed into bytes, obviously. slay.xpt_readβ the buffer for the data that got read.
okay now the actual functions:
own_command_wait()β grabs the 1-Wire bus (and waits if it has to, no drama), sends the command, then releases the bus. very "in and out, quick trip" energy.own_send_command()β sends the command without reserving the bus first. bold of you.pdevis the client device β that's the presentation layer device β the one sending the command.cmddescribes the transaction you want to yeet onto the 1-Wire bus.own_self_command()β fills incmdwith aMATCH_ROMROM command, the ROM address ofpdev, and thexpt_cmd. it's the convenient lil shortcut for building directed commands. obsessed. π
π Bus Reservation π
the 1-Wire system has an advisory lock on the bus that presentation layer devices can use to coordinate access with each other.
heads up bestie: the locking is purely advisory at this time. it's a vibe, not a cage.
own_acquire_bus()β reserves the bus. ifhowisOWN_WAIT, it waits indefinitely (iconic patience). if you passOWN_DONTWAITand another client owns the bus, it returns the errorEWOULDBLOCKinstead. πown_release_bus()β releases the bus. say thank you and let it go.
π§ Data Integrity π§
own_crc()β computes the 1-Wire standard CRC function over the data passed inbufferandlen, and returns the result. it's the "are you sure about that" of the 1-Wire world, and honestly, we should all have one. π
π¦ Notes π¦
the 1-Wire standard (Maxim AN937) defines layers that are akin to ISO networking layers. let's break it down:
- the lowest relevant layer is the link layer β it defines the polling windows and the timing of the signaling of the different modes.
- the network layer is built on top of the link layer, and it's used to address devices in a unicast or multicast manner.
- the transport layer defines the commands and responses from the devices.
- the presentation layer is the device-specific commands and actions used to control the specific 1-Wire devices on the bus.
and for real, real:
- these interfaces are implemented by the
ow(4)device. - presentation layer devices (the children of the newbus
ow(4)device) should only call the functions described here. that's your lane, stay in it. π«Ά - the functionality provided by the
owc(4)device (specifically theowll(9)interface) should only be called by theow(4)driver. that's their lane, stay out of it.
β¨ SEE ALSO β¨
βοΈ LEGAL βοΈ
1-Wire is a registered trademark of Maxim Integrated Products, Inc. π·οΈ
π HISTORY π
the own driver first appeared in FreeBSD 11.0. a whole era.
π AUTHORS π
the own device driver and this manual page were written by Warner Losh. the way that one person wrote the driver and the docs? main character energy, truly. π
and that's the whole page bestie β this one shipped as part of Debian, dated July 20, 2015, filed under OWN(9). go forth, talk to your 1-Wire devices responsibly, and remember: advisory locks are advisory. mwah. π πΈ
π¦ 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
- Copyright (c) 2015 M. Warner Losh
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms