2 .\" Copyright (c) 2004 Joerg Wunsch
3 .\" All rights reserved.
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
8 .\" 1. Redistributions of source code must retain the above copyright
9 .\" notice, this list of conditions and the following disclaimer.
10 .\" 2. Redistributions in binary form must reproduce the above copyright
11 .\" notice, this list of conditions and the following disclaimer in the
12 .\" documentation and/or other materials provided with the distribution.
14 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 .Nd "send or receive messages over an SMBus"
51 utility can be used to send or receive messages over an
57 utility has two different modi of operation.
58 The first form shown in the synopsis can be used to
60 the devices on the SMBus.
61 This is done by sending each valid device address one
62 receive byte, and one quick read message, respectively.
63 Devices that respond to these requests will by displayed
64 by their device address, followed by the strings
69 for devices that are readable, writeable, or both, readable
70 and writeable, respectively.
71 The only valid additional option for this modus of operation (besides
74 option that choses the modus) is
76 See below for a description.
78 Note that probing the bus is risky, since individual devices could
79 perform unwanted actions upon receiving one of the mentioned messages.
80 For example, if a particular SMBus device considers
82 write operation issued to it as a request to power off the system,
83 the probing would trigger this action.
85 The second form shown in the synopsis can be used to send or receive
86 arbitrary messages to or from individual devices.
87 This might be useful to explore individual devices on the SMBus, or
88 maybe even to write short shell scripts performing maintenance
89 operations on the bus.
91 Any data values on the command-line are integer values in the
92 range 0 through 255 for byte values, or 0 through 65535 for
94 They can be specified using standard
96 notation (prefix 0 for octal interpretation, or 0x for
97 hexadecimal interpretation).
99 Since the low-order bit of the device address of SMBus devices
100 selects between read and write operations, only even-numbered
101 slave addresses can exist on the bus.
103 The options are as follows:
104 .Bl -tag -width ".Fl o Ar outcnt"
108 format to be used for displaying input data.
109 This option is ignored in messages that do not read any input
110 from the SMBus device.
111 The format defaults to
113 for byte input operations, and to
115 for word input operations.
116 For multi-byte input (block read), the same format is used for
117 each individual byte read from the SMBus.
119 This is the value of the
121 byte to be issued as part of the SMBus message.
125 should be used as the connection to the SMBus, rather than the
129 An SMBus message should be generated to read
131 bytes from the device.
133 An SMBus message should be generated to write
136 The data values to write are expected to follow all of the options
137 (and their arguments) on the command-line, where the number of data
148 parameter specifies which SMBus device to connect to.
149 This option also selects the
150 .Em transfer messages from/to device
151 modus of operation, where a slave address is mandatory.
153 This option specifies that IO operations are word operations,
154 rather than byte operations.
159 (or both) must be equal 2 in this case.
160 Note that the SMBus byte order is defined to be little-endian
161 (low byte first, high byte follows).
164 Not all argument combinations make sense in order to form valid SMBus
168 option has been provided, the following messages can be
170 .Bd -unfilled -offset indent
173 \fBmessage incnt outcnt\fR
181 Note in particular that specifying 0 as a count value
182 has a different meaning than omitting the respective
185 If a command value has been given using the
187 option, the following messages can be generated:
188 .Bd -unfilled -offset indent
191 \fBmessage \&-w incnt outcnt\fR
197 block read no \*(Ge 2 \&-
198 block write no \&- \*(Ge 2
202 .Bl -tag -width ".Pa /dev/smb0" -compact
204 The default device to connect to, unless
209 Exit status is 0 on success, or according to
213 Typical usage examples of the
217 .Dl "smbmsg -f /dev/smb1 -p"
219 Probe all devices on the SMBus attached to
222 .Dl "smbmsg -s 0x70 -i 1"
226 message to the device at address 0x70, and display
227 the received byte using the default format.
229 .Dl "smbmsg -s 0x70 -c 0xff -i 1 -F %d"
233 message to the device at slave address 0x70, using
234 255 (0xff) as the command-byte to send to the device,
235 and display the result using the custom format
238 .Dl "smbmsg -s 0xa0 -c 0 -o 1 0x80"
242 message to the slave device at address 0xa0, using
243 0 as the command-byte value, and 0x80 as the byte to
244 send (after the command).
245 Assuming this might be a Philips PCF8583 real-time clock,
246 this would stop the clock.
248 .Dl "smbmsg -s 0xa0 -c 1 -i 6 -F %02x"
252 command to device at address 0xa0, and read 6 bytes from
253 it, using hexadecimal display.
254 Again, assuming a PCF8583 RTC, this would display the
255 fractions of second, seconds, minutes, hours, year/date,
256 and weekday/month values.
257 Since this RTC uses BCD notation, the actual values displayed
260 .Dl "smbmsg -s 0xa0 -c 2 -o 5 0x00 0x07 0x22 0x16 0x05"
264 command to device at address 0xa0.
265 For the PCF8583 RTC, this would set the clock to Sunday (2004%4)-05-16
268 Diagnostic messages issued are supposed to be self-explanatory.
275 .%T "The SMBus specification"
276 .%O http://www.smbus.org/specs/
281 utility first appeared in
286 utility and this manual page were written by