Scroll to navigation

W1_SEARCH(9) W1 API internal to the kernel W1_SEARCH(9)

NAME

w1_search - Performs a ROM Search & registers any devices found.

SYNOPSIS

void w1_search(struct w1_master * dev, u8 search_type, w1_slave_found_callback cb);

ARGUMENTS

struct w1_master * dev

The master device to search

u8 search_type

W1_SEARCH to search all devices, or W1_ALARM_SEARCH to return only devices in the alarmed state

w1_slave_found_callback cb

Function to call when a device is found

DESCRIPTION

The 1-wire search is a simple binary tree search. For each bit of the address, we read two bits and write one bit. The bit written will put to sleep all devies that don't match that bit. When the two reads differ, the direction choice is obvious. When both bits are 0, we must choose a path to take. When we can scan all 64 bits without having to choose a path, we are done.

See “Application note 187 1-wire search algorithm” at www.maxim-ic.com

AUTHOR

David Fries <David@Fries.net>

Author.

COPYRIGHT

July 2017 Kernel Hackers Manual 4.12