Perl Mongers' Site

Houston.pm

🌐
Content About πŸ—ΊοΈ
❓
πŸ”‘

Delcom VSI/LibUSB Project πŸ”—
1138816162  

🏷️ files 🏷️ project

For the January 2006 meeting, Paul Archer presented a new project he was working on. The idea was to provide Perl access to the USB Visual Signal Indicator from Delcom Engineering. This project was based on a set of articles in the Linux Journal. For more information on the origin of the project, see the notes on the first presentation.

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 libusb. In order to use this library, we need to be able to call C code from Perl. Paul decided to use the Inline::C module to provide this access.

The February 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.

The March 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 LibUSB module ready to be released.

Project Code

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.

Lessons Learned

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.

The Delcom documentation is also quite specific about the request type in being 0x08 when making a usb_control_msg call. Unfortunately, not only does that value not work, but example code that does work uses a value of 0xc8. It turns out that the request type actually encodes three pieces of information, not just an address. In our case, the value should be 0x48 for sending data to the device and 0xc8 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.

Although the Inline::C module has been extremely helpful in accessing libusb from Perl, it has also been the source of some difficulty. Since the Inline::C 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 void as the parameter list.

Also the "DATA" 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 here document or directly calling the Inline->init() method after your use Inline call.

References


Accessing a USB device from Perl πŸ”—
1137801600  

🏷️ presentations 🏷️ news
January 2006
Presenter: Paul Archer
Paul led a group programming session using Inline::C and libusb to control a USB-based programmable light from Perl. The device was fun, the code was interesting, and a good time was had by all.

Graphics in Perl πŸ”—
1129852800  

🏷️ presentations 🏷️ news
October 2005
Presenter: Bill Dillon
This month, Bill presented a talk combining Perl, Graphics, programming metrics, and astronomy. He showed how easy it is to produce various charts with the GD::Graph Perl module. We saw how to convert a data set into line, bar, point, and pie charts. In the process, we also learned a bit about cataclysmic variable stars and amateur astronomy.

Development Tools for Perl πŸ”—
1127260800  

🏷️ presentations 🏷️ news
September 2005
Presenter: G. Wade Johnson
This month was planned as a discussion of development tools for use with Perl and a discussion of projects we are working on. These slides list a few tools that work well with Perl, including editors, an IDE, and version control tools.
Topic: Project Help
Presenter: G. Wade Johnson
One of the members had some questions about Perl program design involving a program from work. We spent about an hour discussing issues of Perl code design.

Text::Query and Getopt::Long πŸ”—
1124582400  

🏷️ presentations 🏷️ news
August 2005
Presenter: Paul Archer
Paul discussed his program for manipulating keywords in image files, focusing on the modules Text::Query and Getopt::Long.

Perl Module: Regexp::Common πŸ”—
1121904000  

🏷️ presentations 🏷️ news
July 2005
Presenter: G. Wade Johnson
After a couple of months of regular expressions, we take a month off and learn how to not write regular expressions. The Regexp::Common module provides relatively easy access to a fairly large number of common regexes for your matching pleasure.
Topic: General Perl Discussion
Presenter: G. Wade Johnson
We had some extra time this month, so the members started a interesting discussion of a number of Perl related topics, including CPAN, pack and unpack, and the modules in the standard Perl distribution.

Basic/Intermediate Perl regular expressions (part 2 of 2) πŸ”—
1119312000  

🏷️ presentations 🏷️ news
June 2005
Presenter: G. Wade Johnson
This month, we finished the discussion of Basic/Intermediate Perl regular expressions. The presentation covered some of the lesser used options and anchors, regex surprises, and some optimization considerations.

Basic/Intermediate Perl regular expressions (part 1 of 2) πŸ”—
1116633600  

🏷️ presentations 🏷️ news
May 2005
Presenter: G. Wade Johnson
We begin the discussion of Basic/Intermediate Perl regular expressions. After a quick refresher on the basics of regular expressions, we go a bit beyond the basics. We also discussed when regular expressions aren't the right tool for the job, readability, and tips for improving your regular expressions.

Perl Module: PARhttpGrab.exehttpGrab.par πŸ”—
1114041600  

🏷️ presentations 🏷️ news
April 2005
Presenter: G. Wade Johnson
We went through the documentation and some examples of the PAR module. This module supports building Perl ARchives (like JARs, except for Perl). It also supports turning those PAR files into executables.

Perl Core Language: References and Quoting πŸ”—
1111363200  

🏷️ presentations 🏷️ news
March 2005
Presenter: G. Wade Johnson
We discussed two basic parts of the Perl language: references and different forms of quoting. Wade covered the basics of references, including how to create and use them. We also touched on objects. Next we turned to Perl's many quoting operators, how they are used, and how they differ.

Testing in Perl πŸ”—
1108944000  

🏷️ presentations 🏷️ news
February 2005
Presenter: G. Wade Johnson
We covered several ways to test Perl scripts and modules, focusing mostly on Test::More. We also discussed an interesting technique to make a script testable as a module.

Intro to Object Oriented Perl πŸ”—
1106265600  

🏷️ presentations 🏷️ news
January 2005
Presenter: G. Wade Johnson
We began a rapid dive into Object Oriented programming in Perl. We started with the basics of what constitutes object oriented programming (OOP). Then, we covered how these concepts are implemented with Perl. The session should be just enough to get you started in OOP with Perl.

Intro to Perl DBI πŸ”—
1098316800  

🏷️ presentations 🏷️ news
October 2004
Presenter: G. Wade Johnson
Wade gave a brief introduction to the Perl DBI. The DBI is Perl's new modular relational database framework. We discussed how to call the DBI for a particular RDBMS, a little SQL overview, and some of the ways to extract data with DBI.

25 most recent posts older than 1098316800
Size:
Jump to:
POTZREBIE
Copyright © 2003-2020 Houston.pm.
Except as otherwise noted, this site is licensed under a Creative Commons Attribution 2.5 License.
The use of the camel image in association with the Perl programming language is a trademark of O'Reilly & Associates, Inc. Used with permission.