tags:

views:

227

answers:

2

Is anyone familiar with how to identify a USB pnp event with Perl on a Windows (win32 system)?

There is Device::USB (Use libusb to access USB devices) but it suitable for linux, and in order to work in Windows it require libusb and even that not require it to works, is there any other option to identify if a USB device is plugged or unplugged on a Win32 system with Perl? If yes, could someone show an example?

A: 

There is an Device::USB for Windows for ActiveState Perl 5.10

Nifle
-1 for this: bad advice! I tried it, and after installing libusb.dll on my computer I'm now having to reinstall Windows since my computer, which only has USB keyboard and USB mouse, was rendered inoperable.
Kinopiko
Try things like that in a virtual machine first. :)
brian d foy
A: 

Device::USB under Win32 has bugs... and it crashes perl.exe :-) never got that before ;-) but i need this package and i hope the bugs will soon be fixed!

I think the biggest problem for the package is Inline::C

The most problems come when you receive large amounts of data (>10 bytes). One of the first things I removed was the pakage Carp, it does more bad than good with this package under win32.

Anyone got it working 'good' under WinXP?!

Greetings

Christian Netherlands

One of the (Out of Memory!? LOL) bugs from Device::USB package:

Out of memory! 
Software error:
Callback called exit at C:/Perl/lib/AutoLoader.pm line 27,  line 1.

For help, please send mail to this site's webmaster, giving this error message and the time and date of the error. 

[Wed Feb 24 15:21:04 2010] AutoLoader.pm: Callback called exit at C:/Perl/lib/AutoLoader.pm line 27, line 1. 

A solution for running the script trough ISS is using undef *DATA; but it isnt the most clean option, its a bit dirty ;-)! but for now it is working... (i hope)

:'( More Errors:

Free to wrong pool 2441d8 not 20100 during global destruction.
Christian