Hi all,
HEre it is my problem.
I would like to be able to read data from a USB device.
In this case, the usb device is a suunto watch (t6c) that stores heartrate,
altitude, speed, cadence.... and X data when exercising.
I have been looking around and I found this CPAN modules: Device::USB that
gives control over USB devices using the C library libusb.
Using a script included in the module, I got this information from the
device: (it is just a print from Data::Dumper).
bless( { 'location' => 0, 'dirname' => '005', 'devices' => [ bless( { 'descriptor' => { 'bcdUSB' => '2.00', 'iProduct' => 2, 'bDeviceSubClass' => 0, 'bDeviceClass' => 0, 'idProduct' => 63104, 'bcdDevice' => '4.00', 'iManufacturer' => 1, 'bMaxPacketSize0' => 8, 'iSerialNumber' => 3, 'bNumConfigurations' => 1, 'idVendor' => 1027, 'bDescriptorType' => 1, 'bDeviceProtocol' => 0 }, 'filename' => '026', 'config' => [ bless( { 'MaxPower' => 300, 'bmAttributes' => 160, 'bNumInterfaces' => 1, 'interfaces' => [ [ bless( { 'bInterfaceSubClass' => 255, 'bNumEndpoints' => 2, 'endpoints' => [ bless( { 'bmAttributes' => 2, 'wMaxPacketSize' => 64, 'bSynchAddress' => 0, 'bRefresh' => 0, 'bEndpointAddress' => 129, 'bInterval' => 0, 'bDescriptorType' => 5 }, 'Device::USB::DevEndpoint' ), bless( { 'bmAttributes' => 2, 'wMaxPacketSize' => 64, 'bSynchAddress' => 0, 'bRefresh' => 0, 'bEndpointAddress' => 2, 'bInterval' => 0, 'bDescriptorType' => 5 }, 'Device::USB::DevEndpoint' ) ], 'bInterfaceProtocol' => 255, 'iInterface' => 2, 'bInterfaceNumber' => 0, 'bDescriptorType' => 4, 'bAlternateSetting' => 0, 'bInterfaceClass' => 255 }, 'Device::USB::DevInterface' ) ] ], 'iConfiguration' => 0, 'wTotalLength' => 32, 'bConfigurationValue' => 1, 'bDescriptorType' => 2 }, 'Device::USB::DevConfig' ) ], 'device' => 9370480 }, 'Device::USB::Device' ),
So, I identified the vendor and product ID and I got information from the watch using this script:
OUTPUT:#!/usr/bin/perl use strict; use warnings; use Device::USB; my $VENDOR = 1027; my $PRODUCT = 63104; my $usb = Device::USB->new(); my $dev = $usb->find_device( $VENDOR, $PRODUCT ); printf "Device: %04X:%04X\n", $dev->idVendor(), $dev->idProduct(); $dev->open(); print "Manufactured by ", $dev->manufacturer(), "\n", " Product: ", $dev->product(), "\n"; exit;
Device: 0403:F680 Manufactured by Suunto Product: Suunto Sports Instrument
Form here, I don't know how to interact with it to get the data stored in
the device. So, any help to point me in the right direction would be
fantastic.
(I have never used perl for opening/interacting with devices.)
Thanks in advance.
F
In reply to Data adquisition from a USB device by flope004
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |