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:

#!/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;
OUTPUT:
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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.