<< free_enumerationusb USB Device Enumeration next_deviceusb >>

USB Comunication Toolbox for Scilab >> Scilab Macros > USB Device Enumeration > get_device_stringusb

get_device_stringusb

Get the VendorID and ProductID of the actual Hid Device enumerated

Calling Sequence

[success_dev,vendor_id,product_id]=get_device_stringusb(comu_type)

Parameters

success_dev
: This function returns 0 on success and -1 on error.
vendor_id
: Return an integer as the vendor id fo the current HID Device enumerate.
product_id
: Return an integer as the product id fo the current HID Device enumerate.
comu_type
: Comunication protocol comunication. This string identify which protocol use. HID, Bulk, Isochronous or CDC "hid", "bulk", "iso" and "cdc" respectively

Description

Get the Vendor ID and Product ID of the current HID Device enumerated

This is a macro designed to use the hid_get_device_string

The "bulk", "iso" and "cdc" implementantion are missing

Examples

enum_success=enumerateusb("hid");
if( ~( enum_success < 0 ) ) then
    success_next = 0;
    M_Vendor=list();
    M_Product=list();
    i=0;
    while( ~( success_next < 0 ) ) 
       i=i+1;
       [success_dev,vendor_id,product_id]=get_device_stringusb("hid");
       M_Vendor($+1)=vendor_id;
       M_Product($+1)=product_id;
       success_next=next_deviceusb("hid"); 
    end
    free_success=free_enumerationusb("hid");
    Devices=zeros(i,2)
    for k=1:i
        Devices(k,1)=M_Vendor(k)
        Devices(k,2)=M_Product(k)
    end
    Devices=dec2hex(Devices);
    disp(Devices);
end

See Also

Authors

<< free_enumerationusb USB Device Enumeration next_deviceusb >>