in reply to Re^5: Device::USB gives "Use of uninitialized value in concatenation" error
in thread Device::USB gives "Use of uninitialized value in concatenation" error
I don't know if the warnings have anything to do with it, but this code:
1 use Device::USB; 2 3 $usb = Device::USB->new(); 4 $dev = $usb->find_device('0403', '6001'); 5 printf("Device: %04X:%04X\n", $dev->idVendor(), $dev->idProduct( +)); 6 $dev->open(); 7 print "Manufactured by: $dev->manufacturer()\n"; 8 print "Product: $dev->product()\n";
gives the concatenation warnings plus:
Can't call method "idVendor" on an undefined value at kk.pl line 5, <D +ATA> line 1.
Here is the part of dmesg that applies
[349416.436284] usb 4-2: new full-speed USB device number 3 using uhci +_hcd [349416.634282] usb 4-2: New USB device found, idVendor=0403, idProduc +t=6001 [349416.634294] usb 4-2: New USB device strings: Mfr=1, Product=2, Ser +ialNumber=3 [349416.634302] usb 4-2: Product: FT232R USB UART [349416.634309] usb 4-2: Manufacturer: FTDI [349416.634316] usb 4-2: SerialNumber: A100X16Z [349416.642482] ftdi_sio 4-2:1.0: FTDI USB Serial Device converter det +ected [349416.642595] usb 4-2: Detected FT232RL [349416.642603] usb 4-2: Number of endpoints 2 [349416.642610] usb 4-2: Endpoint 1 MaxPacketSize 64 [349416.642618] usb 4-2: Endpoint 2 MaxPacketSize 64 [349416.642624] usb 4-2: Setting MaxPacketSize 64 [349416.644397] usb 4-2: FTDI USB Serial Device converter now attached + to ttyUSB0
OK, SLAM ON THE BRAKES: I jumped onto my Ubuntu 13.04 box and ran the same code. It asked for Device::USB. I installed it correcly by using apt-get install libdevice-usb-perl. The warnings went away and all I still have left is the error: "Can't call method "idVendor" on an undefined value at kk.pl line 5, <DATA> line 1." which is probably due to my lack of knowledge so I have to go study this. Thanks for your help and the lesson here is: IF YOU'RE USING UBUNTU, AVOID CPAN!!"
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^7: Device::USB gives "Use of uninitialized value in concatenation" error
by Corion (Patriarch) on Dec 11, 2013 at 07:44 UTC | |
|
Re^7: Device::USB gives "Use of uninitialized value in concatenation" error
by Anonymous Monk on Feb 27, 2014 at 08:59 UTC |