Accessing a USB device from Perl, part 2.

This month we continued Paul Archer's exploration of the Delcom Engineering USB Visual Signal Indicator. Paul is using the libusb library and Inline::C to interface with this hardware device.

Last time, we had managed to get the VSI device to turn on and off the individual colors and combinations of colors. In the time since the last meeting, Paul had worked out the code to manipulate the intensity of the LEDs. He was having trouble configuring the switch to work. This was where we began.

Paul had the documentation for the VSI device that describes all of the control messages that must be sent to make the device work. Unfortunately, he was already aware that the document was not always correct. One of the parameters was different in the sample code that we started with. Changing this value to the one in the documentation would not control the device.

Paul had coded the two commands needed to configure the button support. The button supports two programmable features. One feature generates a confirmation tone each time the button is pushed. The other feature turns off the speak and all LEDs when the button is pushed. These features can be set independently, giving a total of four modes of operation.

Upon careful reading of the documentation, we discovered a discrepency between in the paragraph describing the configuration parameters. Although the document said you could turn both features on with the MSB=0x03, it refered to the bits of interest as bit 6 for Auto Clear and bit 7 for Auto Confirm. When we tried the high bits instead of the low bits, we were able to change modes. During the experimentation, we learned that setting the bits in the most significant byte (MSB) enabled the features. Reseting the bits in the MSB had no effect. Rereading the documentation revealed that setting the bits in the least significant byte disabled the feature.

We modified the subroutine to be much more Perl-friendly and were able to change button modes, more or less at will.

Since the meeting, Paul has expanded the features available in the program to support flashing a color, controlling the speed of flashing, and configuring the buzzer. The prototype code appears to be working quite well. The current prototype is listed below:

Once again, Paul did a great job of leading the presentation. The device is somewhat interesting and the audience participation was good.