Hi all,
I'm writing a perl daemon that needs to access a IO Warrior 24. I'm stuck there as i don't know the USB protocol....
The Device::USB and accompaining modules are installed and working correctly. I can do things like the example in the Device::USB docs, meaning print $dev->manufacturer and so on.
Problem is i don't have a clue on how to read to/write from it...
I was explained there are 2 bytes you can read/write.
Let's say there is byte 0: bit 0 to 7 and byte 1: bit 8 to 15.
What i exactly have to do is read the first 9 bits (0 - 8) and write 0 or 1 to the last one (15).
Anyone has some sample code to get me started?
TIA
vanne
perl and IO Warrior 24
Moderator: Guido Körber
Hi vanne,
what is your target Operating System?
Most people use the iowkit-library for accessing the IOWarrior.
If you know how to make calls from Perl into the C-library (win32 dll for windows, so.lib for linux, no idea about the Mac) everything should be fairly easy.
There are already wrappers for Java, and I have a small lib to access the devices from Python, but I haven't seen an Perl-implementation yet.
But anyway, using the iowkit-lib from Perl is the way to go, since you don't need to know anything about the usb-issues to use it.
All you need is the library-docs and the datasheet for the IOWarrior.
Eberhard
what is your target Operating System?
Most people use the iowkit-library for accessing the IOWarrior.
If you know how to make calls from Perl into the C-library (win32 dll for windows, so.lib for linux, no idea about the Mac) everything should be fairly easy.
There are already wrappers for Java, and I have a small lib to access the devices from Python, but I haven't seen an Perl-implementation yet.
But anyway, using the iowkit-lib from Perl is the way to go, since you don't need to know anything about the usb-issues to use it.
All you need is the library-docs and the datasheet for the IOWarrior.
Eberhard
problem writing to IO Warrior 24
Hi,
I got a bit further with this.
I can read that i want to read but i cant write ti the io warrior :(
I don't use the kernel module or iowkit lib, but i use the parl libusb wrapper.
Here is how i read:
that gives me the fillowing:
If i understand correctly i need an OUT endpoint (and thus another address?) to write to, but i can find only IN endpoints :(
any hints on this?
FYI:
debian:/usr/local/sbin# uname -a
Linux debian 2.6.21-2-686 #1 SMP Wed Jul 11 03:53:02 UTC 2007 i686 GNU/Linux
debian:/usr/local/sbin#
I got a bit further with this.
I can read that i want to read but i cant write ti the io warrior :(
I don't use the kernel module or iowkit lib, but i use the parl libusb wrapper.
Here is how i read:
Code: Select all
#!/usr/bin/perl
use Device::USB;
my $IOW_VENDOR = 0x07c0;
my $IOW_PRODUCT = 0x1501;
my $IOW_CONFIGURATION = 1;
my $IOW_INTERFACE = 0;
my $IOW_IN_ENDPOINT = 0x81;
my $IOW_TIMEOUT = 1000;
my $usb = Device::USB->new();
my $inbuf = "\0" x 2;
my $iow = $usb->find_device($IOW_VENDOR, $IOW_PRODUCT);
$iow->open >= 0 or die "FATAL: Cannot open IOW device: $!\n";
$iow->reset >= 0 or die "FATAL: Cannot reset IOW device: $!\n";
$iow->set_configuration($IOW_CONFIGURATION) >= 0 or die "FATAL: Cannot set IOW configuration: $!\n";
$iow->claim_interface($IOW_INTERFACE) >= 0 or die "FATAL: Cannot claim IOW interface: $!\n";
$iow->interrupt_read($IOW_IN_ENDPOINT, $inbuf, length($inbuf), $IOW_TIMEOUT) >= 0
or die "Cannot read IOW device: $!\n";
print unpack ("b16", $inbuf), "\n";
Code: Select all
debian:/usr/local/sbin# ./write.pl
1001000011111111
debian:/usr/local/sbin#
Code: Select all
debian:/usr/local/sbin# lsusb -vv -s 2:2 | grep -i endpointaddress
bEndpointAddress 0x81 EP 1 IN
bEndpointAddress 0x82 EP 2 IN
debian:/usr/local/sbin#
FYI:
debian:/usr/local/sbin# uname -a
Linux debian 2.6.21-2-686 #1 SMP Wed Jul 11 03:53:02 UTC 2007 i686 GNU/Linux
debian:/usr/local/sbin#
-
- Site Admin
- Posts: 2856
- Joined: Tue Nov 25, 2003 10:25 pm
- Location: Germany/Berlin
- Contact: