Hi,

I have a DLL from FTDI (ftd2xx.dll www.ftdichip.com) for a USB device. I
try to write a simple perl script to list a number of (FTD) USB devices
connected to a PC. My code below got an error on invalid parameter;

Argument "M-\0\0\0\0\" isn't numeric in subroutine entry at demo.pl line
# 

I guess I did not pass a hex data in the function call properly. Can
someone help me?

Thanks.

Eugene
 
######## code snippet #######

use strict;
use Win32::API;
use Carp;
use warnings;

# from FTD2xx programmer guide: 
# FT_ListDevices(PVOID numDevs,PVOID NULL,DWORD FT_LIST_NUMBER_ONLY)
# FT_LIST_NUMBER_ONLY is defined in FTD2xx.h as 
#define FT_LIST_NUMBER_ONLY = 0x80000000
#
my $function = new Win32::API("ftd2xx", "FT_ListDevices", "PPN", "N");
if (not defined $function) {
   die "Can't import API FT_ListDevices: $!\n";
}
my $DevBuffer = " " x 80;
my $FT_LIST_NUMBER_ONLY=pack('N', 0x80000000);
my $status=$function->Call($DevBuffer,0,$FT_LIST_NUMBER_ONLY);
print "status: $status\n";
print "DeviceNumber: $DevBuffer";
_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to