setpib(1)

โœจ setpib โ€” the Qualcomm Atheros PIB File Editor, bestie edition โœจ

okay so real talk, this is setpib(1) from the Qualcomm Atheros Open Powerline Toolkit, and she is powerful in a slightly scary way. buckle up. ๐ŸŽ€


๐Ÿ“– NAME

setpib โ€” Qualcomm Atheros PIB File Editor ๐Ÿ’…


๐Ÿฆ‹ SYNOPSIS

setpib [options] file base [type data] [type data] [...]

๐ŸŒธ DESCRIPTION

So basically: setpib replaces one or more values inside a Qualcomm Atheros powerline parameter file (a.k.a. a PIB file) and then re-computes the checksum. slay. โœจ

The way you tell it what to change is by handing it a whole lil sequence of type/data pairs. and here's the thing, bestie โ€” you have to already know the offset, the length, and the type of every value you're touching. if you don't? problems. certain problems. ๐Ÿ˜ญ this program makes absolutely no effort to validate offsets or values. none. zero. not even a little vibe check.

ngl this program can change any PIB value, and yes that includes the ones that should not be changed. ๐Ÿšฉ be warned: some PIB values are derived from, or interact with, other PIB values. if you ignore those dependencies, you may diminish performance or straight-up render a device inoperable. ๐Ÿ’€

Atheros does not recommend using this program to edit PIB parameters, because small mistakes can cause big problems. Also, Atheros is under no obligation to give customers the offset, length or type of any PIB file parameter. so likeโ€ฆ you're on your own, girlie. ๐Ÿ™ˆ

Atheros recommends using program modpib to change device identity parameters, and the Windows Device Manager to change other parameters, whenever possible. that's the โœจ responsible โœจ route. ๐Ÿ‘‘

This program handles the older Thunderbolt/Lightning parameter files and the newer Panther/Lynx parameter files โ€” but it has a larger footprint that may not be acceptable for embedded systems. so if you only ever use the older ones, or only ever use the newer ones, consider:

  • setpib1 โ€” an older Thunderbolt/Lightning only version ๐ŸŒฉ๏ธ
  • setpib2 โ€” a newer Panther/Lynx only version ๐Ÿ†

This program is part of the Qualcomm Atheros Powerline Toolkit. see the AMP man page for an overview and installation instructions. ๐Ÿซถ


๐Ÿ’– OPTIONS ๐Ÿ’–

  • -q โ€” Enable quiet mode, which has no effect. that's it. that's the whole option. iconic behaviour honestly. ๐Ÿ’€
  • -v โ€” Print a hexdump of the edited region. if this option appears twice, print hexdump headers too. the region window can be changed with option -w. ๐Ÿ”
  • -w window โ€” The display window, in bytes. when option -v is present, PIB information surrounding the edited region gets displayed to provide some sort of context, and the edited region appears in the middle of this window. default window is 32 bytes. that means the 32 bytes before and the 32 bytes after the edited region are included in the display. ๐ŸชŸ
  • -x โ€” Repair the checksum. by default, this program does not modify files that fail the size or checksum test on input. on top of that, it does not re-compute the checksum on output if no data has changed. this option skips the size and checksum test on input and re-computes the checksum on output even if no data has changed. ๐Ÿฉน
โš ๏ธ This option only works on legacy PIB files. It does not work on PIB files having NVM file format. no cap.
  • -?, --help โ€” Print the program help summary on stdout. this option takes precedence over other options on the command line. ๐Ÿ‘‘
  • -!, --version โ€” Print program version information on stdout. this option takes precedence over other options on the command line. use this option when sending screen dumps to Atheros Technical Support so they know exactly which version of the Linux Toolkit you're running. ๐Ÿ“ธ

๐ŸŒˆ ARGUMENTS

  • file โ€” The PIB filename. the file must exist and it will be re-written. no assumptions are made based on the filename and no filename conventions are enforced. this argument is required and it must come before the base argument. ๐Ÿ“
  • base โ€” The byte offset where changes will start. the offset is expressed in hexadecimal, with (or without) the leading "0x". changes are applied in order, left to right, and the offset automatically increments by the correct amount after each change is applied. this lets you change consecutive PIB locations with just one command. ๐ŸŽฏ this argument is required, must follow the file argument, and must also precede all format/data pairs. normally you'd need multiple setpib commands to change non-consecutive PIB locations โ€” but careful use of format skip can achieve the same results with one command. iykyk. โœจ
  • type โ€” The implied length and encoding of the data. valid types are byte, word, long, data and hfid. a valid format must precede each data item. a byte is 8 bits, a word is 16 bits, a long is 32 bits and a huge is 64 bits. the format implies the maximum data value, except for format data, which is limited by the number of octets entered on the command line. ๐Ÿงฎ
  • data โ€” The information written to the current PIB offset. integer data may be expressed in binary, decimal or hexadecimal, but must not exceed the type minimum or maximum. string data may contain any ASCII characters that can be entered via keyboard, but must be enclosed in quotes when spaces are included. binary values start with 0b or 0B, and hexadecimal values start with 0x or 0X. ๐Ÿ”ข

๐ŸŽ€ FORMATS ๐ŸŽ€

byte integer

A signed or unsigned integer stored as 8 bits or 1 byte. the value is expressed in decimal by default. a binary value may be expressed with a 0b prefix. a hexadecimal value may be expressed using a 0x prefix. negative type/data values must appear at the end of the command line, after option "--", to avoid parsing errors. the offset increments by 1 prior to the next insertion. ๐Ÿ“

word integer

A signed or unsigned integer stored as 16 bits or 2 bytes. the value is expressed in decimal by default. a binary value may be expressed with a 0b prefix. a hexadecimal value may be expressed using a 0x prefix. negative type/data values must appear at the end of the command line, after option "--", to avoid parsing errors. the offset increments by 2 prior to the next insertion. ๐Ÿ“

long integer

A signed or unsigned integer stored as 32 bits or 4 bytes. the value is expressed in decimal by default. a binary value may be expressed with a 0b prefix. a hexadecimal value may be expressed using a 0x prefix. negative type/data values must appear at the end of the command line, after option "--", to avoid parsing errors. the offset increments by 4 prior to the next insertions. ๐Ÿ“

huge integer

A signed or unsigned integer stored as 64 bits or 8 bytes. the value is expressed in decimal by default. a binary value may be expressed with a 0b prefix. a hexadecimal value may be expressed using a 0x prefix. the offset increments by 8 prior to the next insertion. negative type/data values must appear at the end of the command line, after option "--", to avoid parsing errors.

โญ This format is only available on hosts that support 64 bit data values. know your machine, bestie.

data hex

A sequence of hexadecimal octets. octets may be separated by a colon for clarity. the number of octets determines the number of bytes written. the offset increments by the number of bytes written. this is similar to "key" and "mac" below, but it accepts variable length input. ๐Ÿฆ‹

key hex

A sequence of hexadecimal octets. octets may be separated by a colon for clarity. the number of octets must convert to 16 bytes or an error will occur. the offset increments by 16 prior to the next insertion. this is similar "data" above but accepts only fixed length input. this option may be used to set the DAK, NMK or NVAK values. ๐Ÿ”‘

mac hex

A sequence of hexadecimal octets. octets may be separated by a colon for clarity. the number of octets must convert to 6 bytes or an error will occur. the offset increments by 6 prior to the next insertion. this is similar "data" above but accepts only fixed length input. this option may be used to set the DAK, NMK or NVAK values. ๐Ÿซง

text string

An ASCII character string. the string length determines the number of bytes stored. the string is stored with a NUL terminator included. it is not padded or truncated. the offset increments by the number of bytes stored prior to the next insertion. this option may be used to enter a variable length string. ๐Ÿ“

hfid string

An ASCII character string. the string is always stored as 64 bytes. short strings are padded on the right with NUL characters. long strings are truncated on the right and the last byte is forced to NUL. the offset increments by 64 bytes prior to the next insertion. this option may be used to enter user, network and manufacturer identification strings. ๐Ÿท๏ธ

zero count

An unsigned integer representing the number of consecutive bytes to fill with 0x00. the offset increments by the number of bytes written. this option may be used to erase regions of the PIB. ๐Ÿงผ

fill count

An unsigned integer representing the number of consecutive bytes to fill with 0xFF. the offset increments by the number of bytes written. this option may be used to erase regions of the PIB. ๐Ÿ–Œ๏ธ

skip count

An unsigned integer indicating the number of bytes to skip over before starting another change. intervening data locations are unchanged. ๐Ÿฆ˜


to be continued, bestieโ€ฆ part 2 is coming ๐Ÿ’œ

โœจ TR69 DATA TYPES โœจ

okay so these are the special TR-69 flavored string types and bestie, they do not play about their fixed sizes. every single one of them is a fixed-width ASCII situation: too short and it gets padded, too long and it gets chopped. no cap. ๐Ÿ’…

  • accesspassword โ€” string energy. it's an ASCII character string, and it is always stored as 257 bytes. short strings get padded on the right with NUL characters, long strings get truncated on the right and that last byte gets forced to NUL. the offset increments by 257 prior to the next insertion.
  • accessusername โ€” ASCII character string, always stored as 33 bytes. short ones get padded on the right with NULs, long ones get truncated on the right with the last byte forced to NUL. the offset increments by 33 prior to the next insertion.
  • adminpassword โ€” ASCII character string, always stored as 33 bytes. short โ†’ right-padded with NULs, long โ†’ truncated on the right with the last byte forced to NUL. offset increments by 33 prior to the next insertion.
  • adminusername โ€” ASCII character string, always stored as 33 bytes. short โ†’ right-padded with NULs, long โ†’ truncated on the right with the last byte forced to NUL. offset increments by 33 prior to the next insertion.
  • password โ€” ASCII character string, always stored as 257 bytes. short โ†’ right-padded with NULs, long โ†’ truncated on the right with the last byte forced to NUL. offset increments by 257 prior to the next insertion.
  • url โ€” ASCII character string, always stored as 257 bytes. short โ†’ right-padded with NULs, long โ†’ truncated on the right with the last byte forced to NUL. offset increments by 257 prior to the next insertion.
  • username โ€” ASCII character string, always stored as 257 bytes. short โ†’ right-padded with NULs, long โ†’ truncated on the right with the last byte forced to NUL. offset increments by 257 prior to the next insertion.

๐Ÿ“ EXAMPLES ๐Ÿ“

example the first โ€” this one edits the file abc.pib by writing decimal value 1 at offset 01F7 followed by hexadecimal value 00B052BABE01. a partial dump gets printed showing 16 bytes before and 16 bytes after the changed data because the default display windows is 16 bytes. unless the change lands right at the start or end of the file, it'll show up in the center of the display window. iconique behavior honestly ๐Ÿ‘‘

# setpib -v abc.pib 01F7 byte 1 data 00:B0:52:BA:BE:01
000001D0                       00 00 00 00 00 00 00 00 00
.........
000001E0  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
................
000001F0  00 00 00 00 00 00 00 01 00 B0 52 BA BE 01 00 00
..........R.....
00000200  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
................
00000210  00 00 00 00 00 00 00 00 00 00 00 00 00 00
..............

example the second โ€” this one sets the manufacturer HFID string in PIB file def.pib. HFID strings are 64 characters long and either truncated or padded on the right with NUL characters. and heads up bestie, you may need to enclose the string in quotes if it contains spaces. ๐Ÿซถ

# setpib -v def.pib 24 hfid "Galactic Software Pirates, Inc."
00000000              38 1F 00 00 30 1B EB 04 00 B0 52 00
8...0.....R.
00000010  00 66 50 D3 E4 93 3F 85 5B 70 40 78 4D F8 15 AA
.fP...?.[p@xM...
00000020  8D B7 00 00 47 61 6C 61 63 74 69 63 20 53 6F 66
....Galactic Sof
00000030  74 77 61 72 65 20 50 69 72 61 74 65 73 2C 20 49  tware
Pirates, I
00000040  6E 63 2E 00 00 00 00 00 00 00 00 00 00 00 00 00
nc..............
00000050  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
................
00000060  00 00 00 00 50 D3 E4 93 3F 85 5B 70 40 78 4D F8
....P...?.[p@xM.
00000070  15 AA 8D B7 49 6E 74 65 6C 6C 6F 6E 20 45 6E 61
....Atheros Ena
00000080  62 6C 65 64                                      bled

example the third โ€” this one displays the contents of PIB file abc.pib without changing any data. the region displayed is 24 bytes starting at offset 0x24. the format skip specifies the region but does not change it. by default, the 32 bytes before and 32 bytes after are included in the display. this technique can be used to inspect a specific portion of a PIB file. lowkey a little peek, no touch, we respect boundaries here ๐Ÿ’–

# setpib -v abc.pib 24 skip 64
00000000              38 1F 00 00 30 1B EB 04 00 B0 52 00
8...0.....R.
00000010  00 66 50 D3 E4 93 3F 85 5B 70 40 78 4D F8 15 AA
.fP...?.[p@xM...
00000020  8D B7 00 00 47 61 6C 61 63 74 69 63 20 53 6F 66
....Galactic Sof
00000030  74 77 61 72 65 20 50 69 72 61 74 65 73 2C 20 49  tware
Pirates, I
00000040  6E 63 2E 00 00 00 00 00 00 00 00 00 00 00 00 00
nc..............
00000050  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
................
00000060  00 00 00 00 50 D3 E4 93 3F 85 5B 70 40 78 4D F8
....P...?.[p@xM.
00000070  15 AA 8D B7 49 6E 74 65 6C 6C 6F 6E 20 45 6E 61
....Atheros Ena
00000080  62 6C 65 64                                      bled

example the fourth โ€” same vibe, but for a negative value. and this one is tricky because that minus sign is gonna get interpreted as the start of another option ๐Ÿ˜ญ so we must use -- to end normal option parsing. it's a POSIX standard feature, bestie โ€” see IEEE Std 1002.1-2001, Section 12.2, Utility Syntax Guidelines for more an explanation.

# setpib -v abc.pib 1471 -- long -50
00001450    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
...............
00001460 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
................
00001470 00 CE FF FF FF 00 00 00 00 00 00 00 00 00 00 00
................
00001480 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
................
00001490 00 00 00 00 00                                  .....

example the fifth โ€” this one computes a new checksum without changing any data. the filename and an offset are required but no other values are needed. this technique can be used to compute a new checksum after modifying the file using software that does not update the checksum. the glow-up is internal, you won't even see it โœจ

# setpib abc.pib 0 -x

โš ๏ธ DISCLAIMER โš ๏ธ

PIB file structure and content is proprietary to Qualcomm Atheros, Ocala FL USA. consequently, public information is not available. Qualcomm Atheros reserves the right to modify PIB file structure or content in future firmware releases without any obligation to notify or compensate users of this program. so likeโ€ฆ don't come for us, okay? ๐Ÿ™ˆ


๐Ÿ‘€ SEE ALSO ๐Ÿ‘€

chkpib(7), chkpib2(7), getpib(7), modpib(1), pib2xml(1), pibcomp(1), pibdump(1), xml2pib(1)

the whole friend group fr fr ๐Ÿซถ go say hi


๐ŸŒˆ CREDITS ๐ŸŒˆ

Charles Maier ]


and that's the whole page bestie, we ate and left absolutely no crumbs ๐Ÿ‘‘๐Ÿ’… this lil gem is open-plc-utils-0.0.3 from November 2013, and it's the setpib(1) manual page โ€” iconic, timeless, and still serving. mwah ๐Ÿ’–โœจ