1 .\" Copyright (c) 2004 Joerg Wunsch
2 .\" All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\" notice, this list of conditions and the following disclaimer in the
11 .\" documentation and/or other materials provided with the distribution.
13 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 .Nd "send or receive messages over an SMBus"
48 utility can be used to send or receive messages over an
54 utility has two different modi of operation.
55 The first form shown in the synopsis can be used to
57 the devices on the SMBus.
58 This is done by sending each valid device address one
59 receive byte, and one quick read message, respectively.
60 Devices that respond to these requests will be displayed
61 by their device address, followed by the strings
66 for devices that are readable, writeable, or both, readable
67 and writeable, respectively.
68 The only valid additional option for this modus of operation (besides
71 option that chooses the modus) is
73 See below for a description.
75 Note that probing the bus is risky, since individual devices could
76 perform unwanted actions upon receiving one of the mentioned messages.
77 For example, if a particular SMBus device considers
79 write operation issued to it as a request to power off the system,
80 the probing would trigger this action.
82 The second form shown in the synopsis can be used to send or receive
83 arbitrary messages to or from individual devices.
84 This might be useful to explore individual devices on the SMBus, or
85 maybe even to write short shell scripts performing maintenance
86 operations on the bus.
88 Any data values on the command-line are integer values in the
89 range 0 through 255 for byte values, or 0 through 65535 for
91 They can be specified using standard
93 notation (prefix 0 for octal interpretation, or 0x for
94 hexadecimal interpretation).
96 Since the low-order bit of the device address of SMBus devices
97 selects between read and write operations, only even-numbered
98 slave addresses can exist on the bus.
100 The options are as follows:
101 .Bl -tag -width ".Fl o Ar outcnt"
105 format to be used for displaying input data.
106 This option is ignored in messages that do not read any input
107 from the SMBus device.
108 The format defaults to
110 for byte input operations, and to
112 for word input operations.
113 For multi-byte input (block read), the same format is used for
114 each individual byte read from the SMBus.
116 This is the value of the
118 byte to be issued as part of the SMBus message.
122 should be used as the connection to the SMBus, rather than the
126 An SMBus message should be generated to read
128 bytes from the device.
130 An SMBus message should be generated to write
133 The data values to write are expected to follow all of the options
134 (and their arguments) on the command-line, where the number of data
145 parameter specifies which SMBus device to connect to.
146 This option also selects the
147 .Em transfer messages from/to device
148 modus of operation, where a slave address is mandatory.
150 This option specifies that IO operations are word operations,
151 rather than byte operations.
156 (or both) must be equal 2 in this case.
157 Note that the SMBus byte order is defined to be little-endian
158 (low byte first, high byte follows).
161 Not all argument combinations make sense in order to form valid SMBus
165 option has been provided, the following messages can be
167 .Bd -unfilled -offset indent
170 \fBmessage incnt outcnt\fR
178 Note in particular that specifying 0 as a count value
179 has a different meaning than omitting the respective
182 If a command value has been given using the
184 option, the following messages can be generated:
185 .Bd -unfilled -offset indent
188 \fBmessage \&-w incnt outcnt\fR
194 block read no \*(Ge 2 \&-
195 block write no \&- \*(Ge 2
199 .Bl -tag -width ".Pa /dev/smb0" -compact
201 The default device to connect to, unless
206 Exit status is 0 on success, or according to
210 Typical usage examples of the
214 .Dl "smbmsg -f /dev/smb1 -p"
216 Probe all devices on the SMBus attached to
219 .Dl "smbmsg -s 0x70 -i 1"
223 message to the device at address 0x70, and display
224 the received byte using the default format.
226 .Dl "smbmsg -s 0x70 -c 0xff -i 1 -F %d"
230 message to the device at slave address 0x70, using
231 255 (0xff) as the command-byte to send to the device,
232 and display the result using the custom format
235 .Dl "smbmsg -s 0xa0 -c 0 -o 1 0x80"
239 message to the slave device at address 0xa0, using
240 0 as the command-byte value, and 0x80 as the byte to
241 send (after the command).
242 Assuming this might be a Philips PCF8583 real-time clock,
243 this would stop the clock.
245 .Dl "smbmsg -s 0xa0 -c 1 -i 6 -F %02x"
249 command to device at address 0xa0, and read 6 bytes from
250 it, using hexadecimal display.
251 Again, assuming a PCF8583 RTC, this would display the
252 fractions of second, seconds, minutes, hours, year/date,
253 and weekday/month values.
254 Since this RTC uses BCD notation, the actual values displayed
257 .Dl "smbmsg -s 0xa0 -c 2 -o 5 0x00 0x07 0x22 0x16 0x05"
261 command to device at address 0xa0.
262 For the PCF8583 RTC, this would set the clock to Sunday (2004%4)-05-16
265 Diagnostic messages issued are supposed to be self-explanatory.
272 .%T "The SMBus specification"
273 .%U http://www.smbus.org/specs/
278 utility first appeared in
283 utility and this manual page were written by