ch06s07.html 3.8 KB

12345678910111213141516171819202122
  1. <html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Editing a PIB</title><meta name="generator" content="DocBook XSL Stylesheets V1.76.1"><meta name="keywords" content="Intellon, Atheros, Qualcomm, HomePlug, powerline, communications, INT6000, INT6300, INT6400, AR7400, AR7420"><link rel="home" href="index.html" title="Qualcomm Atheros Open Powerline Toolkit"><link rel="up" href="ch06.html" title="Chapter 6.  Scripting"><link rel="prev" href="ch06s06.html" title="Actual Device Identity"><link rel="next" href="ch06s08.html" title="Initialize a Device"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">
  2. Editing a PIB
  3. </th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch06s06.html">Prev</a> </td><th width="60%" align="center">Chapter 6. 
  4. Scripting
  5. </th><td width="20%" align="right"> <a accesskey="n" href="ch06s08.html">Next</a></td></tr></table><hr></div><div class="section" title="Editing a PIB"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="scripting-edit-PIB"></a>
  6. Editing a PIB
  7. </h2></div></div></div><p>
  8. Many scripts place a device in a known state by editing a <acronym class="acronym">PIB</acronym> file and writing it to the device before starting an operation. Program <a class="ulink" href="modpib.7.html" target="_top">modpib</a> can be used for this purpose. It is safe because only certain values can be changed and, where necessary, certain cross-parameter computations are performed automatically.
  9. </p><pre class="programlisting">
  10. modpib -C 0 -M next -D ${DAK} -N ${NMK} ${PIB}
  11. if [ ${?} != 0 ]; then
  12. exit 1
  13. fi
  14. </pre><p>
  15. The example above uses <a class="ulink" href="modpib.7.html" target="_top">modpib</a> to set the CCo state (<strong class="userinput"><code>-C</code></strong>), the MAC address (<strong class="userinput"><code>-M</code></strong>), the <acronym class="acronym">DAK</acronym> (<strong class="userinput"><code>-D</code></strong>) and the <acronym class="acronym">NMK</acronym> (<strong class="userinput"><code>-N</code></strong>) in the defined <code class="varname">PIB</code> file. Argument <code class="constant">0</code> means <span class="quote">“<span class="quote">CCo Auto</span>”</span> and argument <strong class="userinput"><code>next</code></strong> increments the <acronym class="acronym">MAC</acronym> address. The <acronym class="acronym">DAK</acronym> and <acronym class="acronym">NMK</acronym> were defined earlier in the script. Symbol <acronym class="acronym">PIB</acronym> must be defined earlier in the script, possibly in <a class="link" href="ch06s03.html#scripting-firmware-definitions" title="Example 6.2.  firmware.sh">firmware.sh</a>.
  16. </p><p>
  17. Program <a class="ulink" href="modpib.7.html" target="_top">modpib</a> will print an error message and return a non-zero value on error. We test the return value and exit the script on error to avoid subsequent errors. One could, of course, suppress normal output (<strong class="userinput"><code>-q</code></strong>) and print your own error message using the Linux <strong class="userinput"><code>echo</code></strong> utility.
  18. </p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch06s06.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch06.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch06s08.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">
  19. Actual Device Identity
  20.  </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 
  21. Initialize a Device
  22. </td></tr></table></div></body></html>