xml2pib(1) | Qualcomm Atheros Open Powerline Toolkit | xml2pib(1) |
xml2pib - Qualcomm Atheros XML driven PIB editor
xml2pib [options] pib-file [pib-file] [...]
The Atheros PIB XML Editor modifies an Atheros PIB file based on XML instructions defined in one or more instruction files. Instruction files must be valid XML and conform to schema file piboffset.xsd or errors will occur. Always validate XML files against this schema with a validating parser before submitting them to this program. Firefox or Internet Explorer are suitable for validation purposes purpose.
This program is part of the Qualcomm Atheros Powerline Toolkit. See the AMP man page for an overview and installation instructions.
The official Atheros XML PIB Edit schema follows. It defines general instruction file structure and the elements used to edit PIB files. This file should be a controlled document and instruction files should always be validated against it before using them to edit a PIB file. An explanation of this file appears below.
<?xml version='1.0' encoding='iso-8859-1'?>
<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'
elementFormDefault='qualified'>
<xs:element name='pib'>
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs='unbounded' ref='object'/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name='object'>
<xs:complexType>
<xs:attribute name='name' use='required' type='xs:NCName'/>
<xs:sequence>
<xs:sequence>
<xs:element ref='offset'/>
<xs:element ref='length'/>
</xs:sequence>
<xs:choice>
<xs:element ref='array'/>
<xs:element ref='dataString'/>
<xs:element ref='dataHuge'/>
<xs:element ref='dataLong'/>
<xs:element ref='dataWord'/>
<xs:element ref='dataByte'/>
</xs:choice>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name='length' type='xs:positiveInteger'/>
<xs:element name='offset' type='xs:hexBinary'/>
<xs:element name='array'>
<xs:complexType>
<xs:choice maxOccurs='unbounded'>
<xs:element ref='dataByte'/>
<xs:element ref='dataHex'/>
</xs:choice>
</xs:complexType>
</xs:element>
<xs:element name='dataString' type='xs:string'/>
<xs:element name='dataHuge' type='xs:unsignedLong'/>
<xs:element name='dataLong' type='xs:unsignedInt'/>
<xs:element name='dataWord' type='xs:unsignedShort'/>
<xs:element name='dataByte' type='xs:unsignedByte'/>
<xs:element name='dataHex' type='xs:hexBinary'/>
</xs:schema>
The program reads one PIB file and replaces selected values with new ones, computes the new checksum and re-writes the file. New values are defined by offset, length, format and value. The object name is actually irrelevant. Critical values are the offset, length and data type/value. Obviously, care must be taken when specifying offsets and lengths to avoid editing objects incorrectly.
An example instruction file follows. It references the Qualcomm Atheros XML PIB Edit schema file, piboffset.xsd, that is shown above so that a validating parser can find the schema and perform document checks. The remainder of the file describes a series of object names, offsets, lengths and values that describe the edits to be performed.
<pib xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="piboffset.xsd">
<object name="HFID_Manufacturer">
<offset>0024</offset>
<length>64</length>
<dataString>Atheros HomePlug AV Device</dataString>
</object>
<object name="HFID_User">
<length>64</length>
<offset>0074</offset>
<dataString>Atheros</dataString>
</object>
<object name="MDURole">
<offset>0101</offset>
<dataByte>0</dataByte>
</object>
<object name="PriorityTTl">
<offset>0210</offset>
<length>16</length>
<array>
<dataHex>80841E008084</dataHex>
<dataHex>1e</dataHex>
<dataByte>0</dataByte>
<dataHex></dataHex>
<dataHex></dataHex>
<dataHex></dataHex>
<dataHex></dataHex>
<dataHex>C0</dataHex>
<dataByte>198</dataByte>
<dataHex>2d</dataHex>
<dataHex>00</dataHex>
</array>
</object>
<object name="VLANPrioTOSPrecMatrix">
<length>4</length>
<offset>0224</offset>
<array>
<dataByte>65</dataByte>
<dataByte>250</dataByte>
<dataHex></dataHex>
<dataHex>Fa</dataHex>
</array>
</object>
<object name="EnableLEDThroughputIndicate">
<length>1</length>
<offset>1E94</offset>
<dataByte>0</dataByte>
</object>
<object name="HFID_AVLN">
<length>64</length>
<offset>00B4</offset>
<dataString>Atheros-Net</dataString>
</object>
</pib>
The following example reads PIB file abc.pib and edits it according to instructions found in XML file local.xml. The PIB file is always specified first, followed by one or more XML instruction files.
# xml2pib abc.pib local.xml
The following example reads PIB file abc.pib and edits it according to three XML instruction files, in the order specified. Order can be critical since later edits could over-write earlier edits.
# xml2pib abc.pib standard.xml custom.xml errata.xml
The following example does nothing because no instruction files are specified.
# xml2pib abc.pib
chkpib(7), chkpib2(7), getpib(7), modpib(1), pib2xml(1), pibcomp(1), pibdump(1), setpib(1)
Charles Maier
November 2013 | open-plc-utils-0.0.3 |