<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="/styles/rss-style.xsl"?>

<rss version="2.0"
 xmlns:blogChannel="http://backend.userland.com/blogChannelModule"
>

<channel>
<title>houstonperlmongers.org</title>
<link>http://houstonperlmongers.org//project?format=xml</link>
<description>houstonperlmongers.org : /project</description>
<language>en</language>
<pubDate>2026-04-05T16:29:34</pubDate>
<lastBuildDate>2026-04-05T16:29:34</lastBuildDate>

<image>
<title>houstonperlmongers.org</title>
<url>/favicon.ico</url>
<link>http://houstonperlmongers.org</link>
<width>32</width>
<height>32</height>
<description>houstonperlmongers.org favicon</description>
</image>
<item>
<title>Net::Jabber::Bot Project</title>
<link>http://houstonperlmongers.org/posts/e8ffecb3-14d7-11ec-852a-afa5f0bf015a</link>
<description><![CDATA[<div class="content">
    <div id="sidebar">
      <h1 class="heading">Project Lead</h1>
      <p>Todd Rinaldo</p>

      <h1 class="heading">Developers</h1>
      <ul>
        <li>Todd Rinaldo</li>
        <li>Robert Boone</li>
	<li>?</li>
      </ul>
    </div>

    <p>We discussed in the November 2007 meeting Todd doing a presentation of
      <a href="http://search.cpan.org/dist/Net-Jabber-Bot/">Net::Jabber::Bot</a>.
      We also considered the possibility of maintaining the module as a group.
      The following is a summary of the project from Todd.</p>

    <h3 class="subsub">Existing perl Jabber bots in the field</h3>

    <p><a href="http://jpb.sphene.net/wiki/show/JPB">Jpb</a> seemed like a good
    candidate to me originally so I wouldn't have to write my own. The problem
    as I got into it was that the code badly mixed with the config so that I
    would have to alter the modules any time I wanted to change something. I
    decided to write my own.</p>

    <h3 class="subsub"><code>Net::Jabber::Bot</code> Synopsis</h3>

    <p>The module heavily leverages <code>Net::Jabber</code>, which is really
    just a thin shell on top of <code>Net::XMPP</code>. I have developed this
    module over the last few months to allow me to separate out the things one
    wants to do with a bot from the things that can get you in a lot of trouble
    with a bot. The assumption I started with is that most people simply want
    to create a bot that can do something every once and while and that is able
    to react when new messages it cares about are sent. This is what the module
    aims to do.</p>

    <p>Needed code enhancements to the module.</p>

    <ol>
      <li>Needs to be able to react to version requests. This requires being
        able to generate customized messages. This trick is documented between
        <code>Net::XMPP</code> and <code>Net::Jabber</code>, but I lack the
        object-oriented experience to implement it.</li>
      <li>Needs to be able to tell what messages are just history messages.
        Currently the bot does this by ignoring everyone for a period on startup.
        I consider this to be a hack at the moment that sometimes fails if the
        server is slow.</li>
      <li>Make test is a mess. Almost all of the tests require a jabber server
        to be present. This is making the modules tests to look very red on the
        automated CPAN testers site. Robert and Wade told me I should be
        programming to the interface. This sounds like a grand plan but I have
        no idea what it means :)</li>
      <li>Some of my design decisions could use a closer look as to some of the
        values being hard coded, etc. Originally I envisioned a
        <code>Net::Jabber::Bot</code> being inherited from
        <code>Net::Jabber::Bot::Safety</code>, but I decided to just merge the
        2 ideas. I'd love to explore if the choice I made was a good one.</li>
      <li>Currently the module is initialized and connections are made via a new
        being fed a hash from hell. It feels like a kludgy approach to me at the
        moment.</li>
      <li>The re-connect algorithm seems to have issues</li>
      <li>While it's perfectly safe to connect to a jabber server with the same
        username, it's very dangerous to the server to connect with the same
        user/resource. Unfortunately I haven't figured out a way to detect that
        I'm doing this. As a result I've been "chastised" by server admins for
        not noticing that I hadn't killed the old bot when I started the new
        one up.</li>
      <li>Ability to add/leave forums at times other than startup. Probably a
        good candidate for removal from new. I don't know what to look for to
        detect if the join succeeded. Right now I'm just assuming the room
        joins succeed.</li>
    </ol>

    <h3 class="subsub">Documentation need</h3>
    <ol>
      <li>POD documentation is a little loose on the existing subs. I'm not
        documenting the private ones at all except for a few comments in the
        file. Not sure what the etiquette is on this. I really don't think
        they should be showing up on CPAN and if I pod them, they will.</li>
      <li>Need code examples on how to leverage the bot. This is pretty easy to
        provide, but I haven't reverse engineered someone else's CPAN to figure
        out how they do this to make it look right in CPAN.</li>
    </ol>

    <h3 class="subsub">Hosted Project</h3>

    <p>The <a href="http://code.google.com/p/perl-net-jabber-bot/">perl-net-jabber-bot
      project</a> is currently hosted on the Google Code site.</p>

  </div>]]></description>
<author>Nobody</author>
<guid isPermaLink="true">http://houstonperlmongers.org/posts/e8ffecb3-14d7-11ec-852a-afa5f0bf015a</guid>
<pubDate>2007-12-01T17:49:22</pubDate>
<enclosure type="text/html" url="http://houstonperlmongers.org/posts/e8ffecb3-14d7-11ec-852a-afa5f0bf015a" />
</item>
<item>
<title>Net::Jabber::Bot Project</title>
<link>http://houstonperlmongers.org/posts/1196531362</link>
<description><![CDATA[<div class="content">
    <div id="sidebar">
      <h1 class="heading">Project Lead</h1>
      <p>Todd Rinaldo</p>

      <h1 class="heading">Developers</h1>
      <ul>
        <li>Todd Rinaldo</li>
        <li>Robert Boone</li>
	<li>?</li>
      </ul>
    </div>

    <p>We discussed in the November 2007 meeting Todd doing a presentation of
      <a href="http://search.cpan.org/dist/Net-Jabber-Bot/">Net::Jabber::Bot</a>.
      We also considered the possibility of maintaining the module as a group.
      The following is a summary of the project from Todd.</p>

    <h3 class="subsub">Existing perl Jabber bots in the field</h3>

    <p><a href="http://jpb.sphene.net/wiki/show/JPB">Jpb</a> seemed like a good
    candidate to me originally so I wouldn't have to write my own. The problem
    as I got into it was that the code badly mixed with the config so that I
    would have to alter the modules any time I wanted to change something. I
    decided to write my own.</p>

    <h3 class="subsub"><code>Net::Jabber::Bot</code> Synopsis</h3>

    <p>The module heavily leverages <code>Net::Jabber</code>, which is really
    just a thin shell on top of <code>Net::XMPP</code>. I have developed this
    module over the last few months to allow me to separate out the things one
    wants to do with a bot from the things that can get you in a lot of trouble
    with a bot. The assumption I started with is that most people simply want
    to create a bot that can do something every once and while and that is able
    to react when new messages it cares about are sent. This is what the module
    aims to do.</p>

    <p>Needed code enhancements to the module.</p>

    <ol>
      <li>Needs to be able to react to version requests. This requires being
        able to generate customized messages. This trick is documented between
        <code>Net::XMPP</code> and <code>Net::Jabber</code>, but I lack the
        object-oriented experience to implement it.</li>
      <li>Needs to be able to tell what messages are just history messages.
        Currently the bot does this by ignoring everyone for a period on startup.
        I consider this to be a hack at the moment that sometimes fails if the
        server is slow.</li>
      <li>Make test is a mess. Almost all of the tests require a jabber server
        to be present. This is making the modules tests to look very red on the
        automated CPAN testers site. Robert and Wade told me I should be
        programming to the interface. This sounds like a grand plan but I have
        no idea what it means :)</li>
      <li>Some of my design decisions could use a closer look as to some of the
        values being hard coded, etc. Originally I envisioned a
        <code>Net::Jabber::Bot</code> being inherited from
        <code>Net::Jabber::Bot::Safety</code>, but I decided to just merge the
        2 ideas. I'd love to explore if the choice I made was a good one.</li>
      <li>Currently the module is initialized and connections are made via a new
        being fed a hash from hell. It feels like a kludgy approach to me at the
        moment.</li>
      <li>The re-connect algorithm seems to have issues</li>
      <li>While it's perfectly safe to connect to a jabber server with the same
        username, it's very dangerous to the server to connect with the same
        user/resource. Unfortunately I haven't figured out a way to detect that
        I'm doing this. As a result I've been "chastised" by server admins for
        not noticing that I hadn't killed the old bot when I started the new
        one up.</li>
      <li>Ability to add/leave forums at times other than startup. Probably a
        good candidate for removal from new. I don't know what to look for to
        detect if the join succeeded. Right now I'm just assuming the room
        joins succeed.</li>
    </ol>

    <h3 class="subsub">Documentation need</h3>
    <ol>
      <li>POD documentation is a little loose on the existing subs. I'm not
        documenting the private ones at all except for a few comments in the
        file. Not sure what the etiquette is on this. I really don't think
        they should be showing up on CPAN and if I pod them, they will.</li>
      <li>Need code examples on how to leverage the bot. This is pretty easy to
        provide, but I haven't reverse engineered someone else's CPAN to figure
        out how they do this to make it look right in CPAN.</li>
    </ol>

    <h3 class="subsub">Hosted Project</h3>

    <p>The <a href="http://code.google.com/p/perl-net-jabber-bot/">perl-net-jabber-bot
      project</a> is currently hosted on the Google Code site.</p>

  </div>]]></description>
<author>Nobody</author>
<guid isPermaLink="true">http://houstonperlmongers.org/posts/1196531362</guid>
<pubDate>2007-12-01T17:49:22</pubDate>
<enclosure url="http://houstonperlmongers.org/posts/1196531362" type="text/html" />
</item>
<item>
<title>Net::Jabber::Bot Project</title>
<link>http://houstonperlmongers.org/posts/1196531362</link>
<description><![CDATA[<div class="content">
    <div id="sidebar">
      <h1 class="heading">Project Lead</h1>
      <p>Todd Rinaldo</p>

      <h1 class="heading">Developers</h1>
      <ul>
        <li>Todd Rinaldo</li>
        <li>Robert Boone</li>
	<li>?</li>
      </ul>
    </div>

    <p>We discussed in the November 2007 meeting Todd doing a presentation of
      <a href="http://search.cpan.org/dist/Net-Jabber-Bot/">Net::Jabber::Bot</a>.
      We also considered the possibility of maintaining the module as a group.
      The following is a summary of the project from Todd.</p>

    <h3 class="subsub">Existing perl Jabber bots in the field</h3>

    <p><a href="http://jpb.sphene.net/wiki/show/JPB">Jpb</a> seemed like a good
    candidate to me originally so I wouldn't have to write my own. The problem
    as I got into it was that the code badly mixed with the config so that I
    would have to alter the modules any time I wanted to change something. I
    decided to write my own.</p>

    <h3 class="subsub"><code>Net::Jabber::Bot</code> Synopsis</h3>

    <p>The module heavily leverages <code>Net::Jabber</code>, which is really
    just a thin shell on top of <code>Net::XMPP</code>. I have developed this
    module over the last few months to allow me to separate out the things one
    wants to do with a bot from the things that can get you in a lot of trouble
    with a bot. The assumption I started with is that most people simply want
    to create a bot that can do something every once and while and that is able
    to react when new messages it cares about are sent. This is what the module
    aims to do.</p>

    <p>Needed code enhancements to the module.</p>

    <ol>
      <li>Needs to be able to react to version requests. This requires being
        able to generate customized messages. This trick is documented between
        <code>Net::XMPP</code> and <code>Net::Jabber</code>, but I lack the
        object-oriented experience to implement it.</li>
      <li>Needs to be able to tell what messages are just history messages.
        Currently the bot does this by ignoring everyone for a period on startup.
        I consider this to be a hack at the moment that sometimes fails if the
        server is slow.</li>
      <li>Make test is a mess. Almost all of the tests require a jabber server
        to be present. This is making the modules tests to look very red on the
        automated CPAN testers site. Robert and Wade told me I should be
        programming to the interface. This sounds like a grand plan but I have
        no idea what it means :)</li>
      <li>Some of my design decisions could use a closer look as to some of the
        values being hard coded, etc. Originally I envisioned a
        <code>Net::Jabber::Bot</code> being inherited from
        <code>Net::Jabber::Bot::Safety</code>, but I decided to just merge the
        2 ideas. I'd love to explore if the choice I made was a good one.</li>
      <li>Currently the module is initialized and connections are made via a new
        being fed a hash from hell. It feels like a kludgy approach to me at the
        moment.</li>
      <li>The re-connect algorithm seems to have issues</li>
      <li>While it's perfectly safe to connect to a jabber server with the same
        username, it's very dangerous to the server to connect with the same
        user/resource. Unfortunately I haven't figured out a way to detect that
        I'm doing this. As a result I've been "chastised" by server admins for
        not noticing that I hadn't killed the old bot when I started the new
        one up.</li>
      <li>Ability to add/leave forums at times other than startup. Probably a
        good candidate for removal from new. I don't know what to look for to
        detect if the join succeeded. Right now I'm just assuming the room
        joins succeed.</li>
    </ol>

    <h3 class="subsub">Documentation need</h3>
    <ol>
      <li>POD documentation is a little loose on the existing subs. I'm not
        documenting the private ones at all except for a few comments in the
        file. Not sure what the etiquette is on this. I really don't think
        they should be showing up on CPAN and if I pod them, they will.</li>
      <li>Need code examples on how to leverage the bot. This is pretty easy to
        provide, but I haven't reverse engineered someone else's CPAN to figure
        out how they do this to make it look right in CPAN.</li>
    </ol>

    <h3 class="subsub">Hosted Project</h3>

    <p>The <a href="http://code.google.com/p/perl-net-jabber-bot/">perl-net-jabber-bot
      project</a> is currently hosted on the Google Code site.</p>

  </div>]]></description>
<author>Nobody</author>
<guid isPermaLink="true">http://houstonperlmongers.org/posts/1196531362</guid>
<pubDate>2007-12-01T17:49:22</pubDate>
<enclosure type="text/html" url="http://houstonperlmongers.org/posts/1196531362" />
</item>
<item>
<title>Delcom VSI/LibUSB Project</title>
<link>http://houstonperlmongers.org/posts/e87fcc62-14d7-11ec-852a-f89aa00b2286</link>
<description><![CDATA[<div class="content">

    <div id="sidebar">
      <h1 class="heading">Project Lead</h1>
      <p>Paul Archer</p>

      <h1 class="heading">Developers</h1>
      <ul>
        <li>Paul Archer</li>
        <li>G. Wade Johnson</li>
      </ul>
    </div>

    <p>For the <a href="/talks/2006talks/0601Talk/index.html">January 2006</a> meeting,
      Paul Archer presented a new project he was working on. The idea was to provide
      Perl access to the <a href="http://www.delcom-eng.com/products_USBLMP.asp">USB
      Visual Signal Indicator</a> from <a href="http://www.delcom-eng.com/">Delcom
      Engineering</a>. This project was based on a set of articles in the
      <a href="http://www.linux.journal.com/">Linux Journal</a>. For more information on
      the origin of the project, see the notes on the first presentation.</p>

    <p>Since the Delcom VSI is a USB device, controlling it from Perl requires a Perl
      interface to USB. At the time Paul began working on this there was a minimal
      module on CPAN for access to USB, but nothing complete. There is a C library for
      accessing USB devices <a href="http://libusb.sourceforge.net/">libusb</a>. In
      order to use this library, we need to be able to call C code from Perl. Paul
      decided to use the <a href="http://search.cpan.org/~ingy/Inline-0.44/C/C.pod">Inline::C </a> module to
      provide this access.</p>

    <p>The <a href="/talks/2006talks/0602Talk/index.html">February</a> meeting continued
      the group development of some prototype code that was able to exercise the device.
      Some work was accomplished to clean up the code for accessing the libusb library,
      but the main focus was on the VSI itself. Since that time, Wade has been adding
      some time and potential help to the project, focusing mostly on the LibUSB
      interface and a possible language-based interface to the VSI library. We have
      also elicited interface design help from the group at large.</p>

    <p>The <a href="/talks/2006talks/0603Talk/index.html">March</a> meeting concluded
      the sessions on this project. There is still development to do, but as the project
      moves from a prototyping phase into more traditional development, it appears to
      be less interesting in a meeting setting. We did a few new experiments and had a
      bit more discussion about issues relating to getting the <code>LibUSB</code>
      module ready to be released.</p>

    <h3 class="subsub">Project Code</h3>

    <p>This is the latest version of the code developed for this project. Since
      it is a work in progress, don't be surprised if it is not complete.</p>

    <ul>
      <li><a href="./Device-USB-LibUSB-0.02.tar.gz">Device::USB::LibUSB</a>
        module, version 0.02</li>
    </ul>

    <h3 class="subsub">Lessons Learned</h3>

    <p>The Delcom documentation is mostly useful. But it did contain a few
      discrepancies that made life more difficult. In many cases, the text would
      contain a description of parameters to be passed and then an example to
      clarify. These two often did not match. In general, the text seems to be
      right and the example is wrong.</p>

    <p>The Delcom documentation is also quite specific about the request type in
      being <code>0x08</code> when making a <code>usb_control_msg</code> call.
      Unfortunately, not only does that value not work, but example code that does
      work uses a value of <code>0xc8</code>. It turns out that the request type
      actually encodes three pieces of information, not just an address. In our
      case, the value should be <code>0x48</code> for sending data to the device
      and <code>0xc8</code> when requesting data from the device. When just using
      the function to set control parameters (which is most of what we do) either
      parameter appears to work.</p>

    <p>Although the <code>Inline::C</code> module has been extremely helpful in
      accessing <code>libusb</code> from Perl, it has also been the source of some
      difficulty. Since the <code>Inline::C</code> parser is not a full parser, we
      have seen some cases where function prototypes did not act as expected. In
      particular, a function with no parameters cannot be declared with
      <code>void</code> as the parameter list.</p>

    <p>Also the <code>"DATA"</code> approach to declaring the C code inline works
      great in a script, but it does not work so well in a module. The names of
      functions declared in the inline portion will not be available in the module.
      This problem can be solved either by moving the code to a <em>here</em>
      document or directly calling the <code>Inline-&gt;init()</code> method after
      your <code>use Inline</code> call.</p>

    <h3 class="subsub">References</h3>
    <ul>
      <li><a href="http://www.delcom-eng.com/">Delcom Engineering</a></li>
      <li><a href="http://www.delcom-eng.com/products_USBLMP.asp">USB Visual Signal
        Indicator</a></li>
      <li>Linux Journal articles by Greg Kroah-Hartman:
        <ul>
	  <li><a href="http://www.linuxjournal.com/article/7353">Writing a Simple USB Driver</a></li>
	  <li><a href="http://www.linuxjournal.com/article/7466">Writing a Real Driver --
            In User Space</a></li>
	</ul></li>
      <li><a href="http://libusb.sourceforge.net/">libusb</a></li>
      <li><a href="http://www.usb.org/home">USB.org</a>: source for specifications and
        such on the USB.</li>
      <li><a href="http://search.cpan.org/~xantus/Device-USB-0.015/USB.pm">Device::USB</a>
        module providing partial libusb implementation</li>
      <li><a href="http://search.cpan.org/~ingy/Inline-0.44/C/C.pod">Inline::C</a>
        module for accessing C code from Perl</li>
      <li><a href="http://search.cpan.org/~dconway/Parse-RecDescent-1.94/lib/Parse/RecDescent.pod">Parse::RecDescent</a>
        module parsing an input language for controlling the VSI</li>
      <li><a href="http://www.nntp.perl.org/group/perl.inline">inline@perl.org</a>
        mailing list archive</li>
    </ul>

  </div>]]></description>
<author>Nobody</author>
<guid isPermaLink="true">http://houstonperlmongers.org/posts/e87fcc62-14d7-11ec-852a-f89aa00b2286</guid>
<pubDate>2006-02-01T17:49:22</pubDate>
<enclosure url="http://houstonperlmongers.org/posts/e87fcc62-14d7-11ec-852a-f89aa00b2286" type="text/html" />
</item>
<item>
<title>Delcom VSI/LibUSB Project</title>
<link>http://houstonperlmongers.org/posts/1138816162</link>
<description><![CDATA[<div class="content">

    <div id="sidebar">
      <h1 class="heading">Project Lead</h1>
      <p>Paul Archer</p>

      <h1 class="heading">Developers</h1>
      <ul>
        <li>Paul Archer</li>
        <li>G. Wade Johnson</li>
      </ul>
    </div>

    <p>For the <a href="/talks/2006talks/0601Talk/index.html">January 2006</a> meeting,
      Paul Archer presented a new project he was working on. The idea was to provide
      Perl access to the <a href="http://www.delcom-eng.com/products_USBLMP.asp">USB
      Visual Signal Indicator</a> from <a href="http://www.delcom-eng.com/">Delcom
      Engineering</a>. This project was based on a set of articles in the
      <a href="http://www.linux.journal.com/">Linux Journal</a>. For more information on
      the origin of the project, see the notes on the first presentation.</p>

    <p>Since the Delcom VSI is a USB device, controlling it from Perl requires a Perl
      interface to USB. At the time Paul began working on this there was a minimal
      module on CPAN for access to USB, but nothing complete. There is a C library for
      accessing USB devices <a href="http://libusb.sourceforge.net/">libusb</a>. In
      order to use this library, we need to be able to call C code from Perl. Paul
      decided to use the <a href="http://search.cpan.org/~ingy/Inline-0.44/C/C.pod">Inline::C </a> module to
      provide this access.</p>

    <p>The <a href="/talks/2006talks/0602Talk/index.html">February</a> meeting continued
      the group development of some prototype code that was able to exercise the device.
      Some work was accomplished to clean up the code for accessing the libusb library,
      but the main focus was on the VSI itself. Since that time, Wade has been adding
      some time and potential help to the project, focusing mostly on the LibUSB
      interface and a possible language-based interface to the VSI library. We have
      also elicited interface design help from the group at large.</p>

    <p>The <a href="/talks/2006talks/0603Talk/index.html">March</a> meeting concluded
      the sessions on this project. There is still development to do, but as the project
      moves from a prototyping phase into more traditional development, it appears to
      be less interesting in a meeting setting. We did a few new experiments and had a
      bit more discussion about issues relating to getting the <code>LibUSB</code>
      module ready to be released.</p>

    <h3 class="subsub">Project Code</h3>

    <p>This is the latest version of the code developed for this project. Since
      it is a work in progress, don't be surprised if it is not complete.</p>

    <ul>
      <li><a href="./Device-USB-LibUSB-0.02.tar.gz">Device::USB::LibUSB</a>
        module, version 0.02</li>
    </ul>

    <h3 class="subsub">Lessons Learned</h3>

    <p>The Delcom documentation is mostly useful. But it did contain a few
      discrepancies that made life more difficult. In many cases, the text would
      contain a description of parameters to be passed and then an example to
      clarify. These two often did not match. In general, the text seems to be
      right and the example is wrong.</p>

    <p>The Delcom documentation is also quite specific about the request type in
      being <code>0x08</code> when making a <code>usb_control_msg</code> call.
      Unfortunately, not only does that value not work, but example code that does
      work uses a value of <code>0xc8</code>. It turns out that the request type
      actually encodes three pieces of information, not just an address. In our
      case, the value should be <code>0x48</code> for sending data to the device
      and <code>0xc8</code> when requesting data from the device. When just using
      the function to set control parameters (which is most of what we do) either
      parameter appears to work.</p>

    <p>Although the <code>Inline::C</code> module has been extremely helpful in
      accessing <code>libusb</code> from Perl, it has also been the source of some
      difficulty. Since the <code>Inline::C</code> parser is not a full parser, we
      have seen some cases where function prototypes did not act as expected. In
      particular, a function with no parameters cannot be declared with
      <code>void</code> as the parameter list.</p>

    <p>Also the <code>"DATA"</code> approach to declaring the C code inline works
      great in a script, but it does not work so well in a module. The names of
      functions declared in the inline portion will not be available in the module.
      This problem can be solved either by moving the code to a <em>here</em>
      document or directly calling the <code>Inline-&gt;init()</code> method after
      your <code>use Inline</code> call.</p>

    <h3 class="subsub">References</h3>
    <ul>
      <li><a href="http://www.delcom-eng.com/">Delcom Engineering</a></li>
      <li><a href="http://www.delcom-eng.com/products_USBLMP.asp">USB Visual Signal
        Indicator</a></li>
      <li>Linux Journal articles by Greg Kroah-Hartman:
        <ul>
	  <li><a href="http://www.linuxjournal.com/article/7353">Writing a Simple USB Driver</a></li>
	  <li><a href="http://www.linuxjournal.com/article/7466">Writing a Real Driver --
            In User Space</a></li>
	</ul></li>
      <li><a href="http://libusb.sourceforge.net/">libusb</a></li>
      <li><a href="http://www.usb.org/home">USB.org</a>: source for specifications and
        such on the USB.</li>
      <li><a href="http://search.cpan.org/~xantus/Device-USB-0.015/USB.pm">Device::USB</a>
        module providing partial libusb implementation</li>
      <li><a href="http://search.cpan.org/~ingy/Inline-0.44/C/C.pod">Inline::C</a>
        module for accessing C code from Perl</li>
      <li><a href="http://search.cpan.org/~dconway/Parse-RecDescent-1.94/lib/Parse/RecDescent.pod">Parse::RecDescent</a>
        module parsing an input language for controlling the VSI</li>
      <li><a href="http://www.nntp.perl.org/group/perl.inline">inline@perl.org</a>
        mailing list archive</li>
    </ul>

  </div>]]></description>
<author>Nobody</author>
<guid isPermaLink="true">http://houstonperlmongers.org/posts/1138816162</guid>
<pubDate>2006-02-01T17:49:22</pubDate>
<enclosure url="http://houstonperlmongers.org/posts/1138816162" type="text/html" />
</item>
<item>
<title>Delcom VSI/LibUSB Project</title>
<link>http://houstonperlmongers.org/posts/1138816162</link>
<description><![CDATA[<div class="content">

    <div id="sidebar">
      <h1 class="heading">Project Lead</h1>
      <p>Paul Archer</p>

      <h1 class="heading">Developers</h1>
      <ul>
        <li>Paul Archer</li>
        <li>G. Wade Johnson</li>
      </ul>
    </div>

    <p>For the <a href="/talks/2006talks/0601Talk/index.html">January 2006</a> meeting,
      Paul Archer presented a new project he was working on. The idea was to provide
      Perl access to the <a href="http://www.delcom-eng.com/products_USBLMP.asp">USB
      Visual Signal Indicator</a> from <a href="http://www.delcom-eng.com/">Delcom
      Engineering</a>. This project was based on a set of articles in the
      <a href="http://www.linux.journal.com/">Linux Journal</a>. For more information on
      the origin of the project, see the notes on the first presentation.</p>

    <p>Since the Delcom VSI is a USB device, controlling it from Perl requires a Perl
      interface to USB. At the time Paul began working on this there was a minimal
      module on CPAN for access to USB, but nothing complete. There is a C library for
      accessing USB devices <a href="http://libusb.sourceforge.net/">libusb</a>. In
      order to use this library, we need to be able to call C code from Perl. Paul
      decided to use the <a href="http://search.cpan.org/~ingy/Inline-0.44/C/C.pod">Inline::C </a> module to
      provide this access.</p>

    <p>The <a href="/talks/2006talks/0602Talk/index.html">February</a> meeting continued
      the group development of some prototype code that was able to exercise the device.
      Some work was accomplished to clean up the code for accessing the libusb library,
      but the main focus was on the VSI itself. Since that time, Wade has been adding
      some time and potential help to the project, focusing mostly on the LibUSB
      interface and a possible language-based interface to the VSI library. We have
      also elicited interface design help from the group at large.</p>

    <p>The <a href="/talks/2006talks/0603Talk/index.html">March</a> meeting concluded
      the sessions on this project. There is still development to do, but as the project
      moves from a prototyping phase into more traditional development, it appears to
      be less interesting in a meeting setting. We did a few new experiments and had a
      bit more discussion about issues relating to getting the <code>LibUSB</code>
      module ready to be released.</p>

    <h3 class="subsub">Project Code</h3>

    <p>This is the latest version of the code developed for this project. Since
      it is a work in progress, don't be surprised if it is not complete.</p>

    <ul>
      <li><a href="./Device-USB-LibUSB-0.02.tar.gz">Device::USB::LibUSB</a>
        module, version 0.02</li>
    </ul>

    <h3 class="subsub">Lessons Learned</h3>

    <p>The Delcom documentation is mostly useful. But it did contain a few
      discrepancies that made life more difficult. In many cases, the text would
      contain a description of parameters to be passed and then an example to
      clarify. These two often did not match. In general, the text seems to be
      right and the example is wrong.</p>

    <p>The Delcom documentation is also quite specific about the request type in
      being <code>0x08</code> when making a <code>usb_control_msg</code> call.
      Unfortunately, not only does that value not work, but example code that does
      work uses a value of <code>0xc8</code>. It turns out that the request type
      actually encodes three pieces of information, not just an address. In our
      case, the value should be <code>0x48</code> for sending data to the device
      and <code>0xc8</code> when requesting data from the device. When just using
      the function to set control parameters (which is most of what we do) either
      parameter appears to work.</p>

    <p>Although the <code>Inline::C</code> module has been extremely helpful in
      accessing <code>libusb</code> from Perl, it has also been the source of some
      difficulty. Since the <code>Inline::C</code> parser is not a full parser, we
      have seen some cases where function prototypes did not act as expected. In
      particular, a function with no parameters cannot be declared with
      <code>void</code> as the parameter list.</p>

    <p>Also the <code>"DATA"</code> approach to declaring the C code inline works
      great in a script, but it does not work so well in a module. The names of
      functions declared in the inline portion will not be available in the module.
      This problem can be solved either by moving the code to a <em>here</em>
      document or directly calling the <code>Inline-&gt;init()</code> method after
      your <code>use Inline</code> call.</p>

    <h3 class="subsub">References</h3>
    <ul>
      <li><a href="http://www.delcom-eng.com/">Delcom Engineering</a></li>
      <li><a href="http://www.delcom-eng.com/products_USBLMP.asp">USB Visual Signal
        Indicator</a></li>
      <li>Linux Journal articles by Greg Kroah-Hartman:
        <ul>
	  <li><a href="http://www.linuxjournal.com/article/7353">Writing a Simple USB Driver</a></li>
	  <li><a href="http://www.linuxjournal.com/article/7466">Writing a Real Driver --
            In User Space</a></li>
	</ul></li>
      <li><a href="http://libusb.sourceforge.net/">libusb</a></li>
      <li><a href="http://www.usb.org/home">USB.org</a>: source for specifications and
        such on the USB.</li>
      <li><a href="http://search.cpan.org/~xantus/Device-USB-0.015/USB.pm">Device::USB</a>
        module providing partial libusb implementation</li>
      <li><a href="http://search.cpan.org/~ingy/Inline-0.44/C/C.pod">Inline::C</a>
        module for accessing C code from Perl</li>
      <li><a href="http://search.cpan.org/~dconway/Parse-RecDescent-1.94/lib/Parse/RecDescent.pod">Parse::RecDescent</a>
        module parsing an input language for controlling the VSI</li>
      <li><a href="http://www.nntp.perl.org/group/perl.inline">inline@perl.org</a>
        mailing list archive</li>
    </ul>

  </div>]]></description>
<author>Nobody</author>
<guid isPermaLink="true">http://houstonperlmongers.org/posts/1138816162</guid>
<pubDate>2006-02-01T17:49:22</pubDate>
<enclosure type="text/html" url="http://houstonperlmongers.org/posts/1138816162" />
</item>
</channel>
</rss>
