SMBMSG(8)

πŸ“¦ version 15.1, in freebsd 14.5, freebsd 15.1

πŸ’… SMBMSG(8) β€” the group-chat guide

okay so bestie, welcome to smbmsg(8), from the System Manager's Manual, and honestly? she's giving "tiny tool, big personality" energy. let's get into it ✨


🌸 NAME 🌸

smbmsg β€” send or receive messages over an SMBus πŸ’Œ


πŸŽ€ SYNOPSIS πŸŽ€

smbmsg [-f dev] -p

smbmsg [-f dev] -s slave [-F fmt] [-c cmd] [-w] [-i incnt] [-o outcnt]
       [outdata ...]

✨ DESCRIPTION ✨

so the smbmsg utility is literally your little messenger between you and an SMBus β€” see smbus(4) for the lore πŸ’«

smbmsg has two different modi of operation (yes, modi, she's fancy). the first form up in the synopsis is the "probe" era πŸ” β€” you use it to probe the devices chilling on the SMBus. how? by sending each valid device address one receive byte, and one quick read message, respectively. devices that actually respond to these requests get displayed by their device address, followed by the strings 'r', 'w', or 'rw' β€” for devices that are readable, writeable, or both, readable and writeable, respectively. the only valid additional option for this modus of operation (besides the -p option that chooses the modus, obviously) is -f dev. more on that below πŸ‘‡

⚠️ bestie, serious warning time: probing the bus is risky, since individual devices could perform unwanted actions upon receiving one of the mentioned messages. like, for example, if a particular SMBus device considers any write operation issued to it as a request to power off the system, the probing would trigger this action. yeah. πŸ’€ so probe responsibly.

the second form in the synopsis is the free-spirit one πŸ¦‹ β€” you use it to send or receive arbitrary messages to or from individual devices. this might be useful to explore individual devices on the SMBus, or maybe even to write short shell scripts performing maintenance operations on the bus. main character energy fr fr πŸ‘‘

any data values on the command-line are integer values in the range 0 through 255 for byte values, or 0 through 65535 for word values. and you can specify them using standard 'C' notation (prefix 0 for octal interpretation, or 0x for hexadecimal interpretation) β€” cute and classic 🧚

since the low-order bit of the device address of SMBus devices selects between read and write operations, only even-numbered slave addresses can exist on the bus. that's just how she is πŸ’…

the options are as follows:

  • -F fmt β€” specify the printf(3) format to be used for displaying input data. this option is ignored in messages that do not read any input from the SMBus device. the format defaults to '0x%02x' for byte input operations, and to '0x%04x' for word input operations. for multi-byte input (block read), the same format is used for each individual byte read from the SMBus. consistent queen πŸŽ€
  • -c cmd β€” this is the value of the command byte to be issued as part of the SMBus message.
  • -f dev β€” this specifies that dev should be used as the connection to the SMBus, rather than the default of /dev/smb0. pick your fav 🫢
  • -i incnt β€” an SMBus message should be generated to read incnt bytes from the device.
  • -o outcnt β€” an SMBus message should be generated to write outcnt bytes to the device. the data values to write are expected to follow all of the options (and their arguments) on the command-line, where the number of data bytes must match the outcnt value. no skipping, no vibes-based counting 😌
  • -p β€” this selects the probe bus modus of operation. πŸ”
  • -s slave β€” the slave parameter specifies which SMBus device to connect to. this option also selects the transfer messages from/to device modus of operation, where a slave address is mandatory. she's a package deal πŸ’–
  • -w β€” this option specifies that IO operations are word operations, rather than byte operations. either incnt, or outcnt (or both) must be equal 2 in this case. note that the SMBus byte order is defined to be little-endian (low byte first, high byte follows). low byte walked so high byte could run ✨

not all argument combinations make sense in order to form valid SMBus messages. if no -c cmd option has been provided, the following messages can be issued:

  • quick read β€” incnt 0, outcnt -
  • quick write β€” incnt -, outcnt 0
  • receive byte β€” incnt 1, outcnt -
  • send byte β€” incnt -, outcnt 1

note in particular that specifying 0 as a count value has a different meaning than omitting the respective option entirely. they are not the same girl, do not confuse them πŸ™ˆ

if a command value has been given using the -c cmd option, the following messages can be generated:

  • read byte β€” -w: no, incnt 1, outcnt -
  • write byte β€” -w: no, incnt -, outcnt 1
  • read word β€” -w: yes, incnt 2, outcnt -
  • write word β€” -w: yes, incnt -, outcnt 2
  • process call β€” -w: yes, incnt 2, outcnt 2
  • block read β€” -w: no, incnt β‰₯ 2, outcnt -
  • block write β€” -w: no, incnt -, outcnt β‰₯ 2

πŸ¦‹ FILES πŸ¦‹

  • /dev/smb0 β€” the default device to connect to, unless -f dev has been provided. she's the default for a reason 🌟

πŸ’œ EXIT STATUS πŸ’œ

exit status is 0 on success, or according to sysexits(3) in case of failure. so if it's not 0, go read sysexits(3) and have your moment 😭


πŸ”₯ EXAMPLES πŸ”₯

typical usage examples of the smbmsg command include:

smbmsg -f /dev/smb1 -p

probe all devices on the SMBus attached to /dev/smb1. go say hi to everybody πŸ‘‹

smbmsg -s 0x70 -i 1

issue a receive byte message to the device at address 0x70, and display the received byte using the default format. cute and simple πŸŽ€

smbmsg -s 0x70 -c 0xff -i 1 -F %d

issue a read byte message to the device at slave address 0x70, using 255 (0xff) as the command-byte to send to the device, and display the result using the custom format '%d'. customized, personalised, iconic πŸ’…

smbmsg -s 0xa0 -c 0 -o 1 0x80

send a write byte message to the slave device at address 0xa0, using 0 as the command-byte value, and 0x80 as the byte to send (after the command). assuming this might be a Philips PCF8583 real-time clock, this would stop the clock. yeah she can do that 😳

smbmsg -s 0xa0 -c 1 -i 6 -F %02x

send a block read command to device at address 0xa0, and read 6 bytes from it, using hexadecimal display. again, assuming a PCF8583 RTC, this would display the fractions of second, seconds, minutes, hours, year/date, and weekday/month values. since this RTC uses BCD notation, the actual values displayed were decimal then. history lesson AND a read command, we love a multitasker πŸ“šβœ¨

smbmsg -s 0xa0 -c 2 -o 5 0x00 0x07 0x22 0x16 0x05

send a block write command to device at address 0xa0. for the PCF8583 RTC, this would set the clock to Sunday (2004%4)-05-16 22:07:00. time travel but make it SMBus β°πŸ¦‹


🌈 DIAGNOSTICS 🌈

diagnostic messages issued are supposed to be self-explanatory. she tells you what's wrong, you just gotta listen πŸ’€


⭐ SEE ALSO ⭐

printf(3), sysexits(3), smb(4), smbus(4)

the SMBus specification, http://www.smbus.org/specs/ β€” go read the source material bestie, iykyk πŸ“–


πŸ‘‘ HISTORY πŸ‘‘

the smbmsg utility first appeared in FreeBSD 5.3. a legend was born πŸŽ€


🌸 AUTHORS 🌸

the smbmsg utility and this manual page were written by Jârg Wunsch. thank you for your service 🫢


and that's the whole page, bestie πŸ’– this edition is from Debian, dated May 16, 2004, filed under SMBMSG(8) β€” go forth and message some SMBus devices, responsibly, periodt βœ¨πŸ¦‹πŸŽ€

πŸ“¦ where this page comes from