<< get_serialusb USB Device Strings

USB Comunication Toolbox for Scilab >> Scilab Macros > USB Device Strings > get_stringusb

get_stringusb

Get a string from a USB device, based on its string index.

Calling Sequence

[indexed_string,string_success]=get_stringusb(index_pos,comu_type)

Parameters

index_pos
: The index of the string to get. The type of index_pos has to be unsigned integer 16 bits
indexed_string
: string A wide string
string_success
: This function returns 0 on success and -1 on error
comu_type
: Comunication protocol comunication. This string identify which protocol use. HID, Bulk, Isochronous or CDC "hid", "bulk", "iso" and "cdc" respectively

Description

Get a string from a USB device, based on its string index.. Scilab macro's for hid_get_string

This is a macro designed to use the hid_get_string

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

Examples

clc
VendorID="04D8";
ProductID="900A";
init_success=initusb("hid");
if ( init_success < 0 ) then
   disp("unable to initialize the HIDAPI Library");
   return
else
     disp("HIDAPI Library initialized");
end
open_success=openusb(VendorID,ProductID,"hid");
if ( open_success < 0 ) then
     disp("unable to open device");
     return
else
     disp("Device Open");
end
for i=1:3
    [indexed_string,string_success]=get_stringusb(i,"hid")
    if ( string_success < 0 ) then
         disp("unable to get indexed string");
         close_success=closeusb("hid");
         exit_success=exitusb("hid");
         return
    else
         disp(indexed_string);
    end    
end
close_success=closeusb("hid");  
if ( close_success < 0 ) then
   disp("unable to closed device");
else
   disp("device closed");
end
exit_success=exitusb("hid");
if ( exit_success < 0 ) then
   disp("unable to free static data associated with HIDAPI Library");
   return
else
   disp("HIDAPI Library have been freed all of the static data associated");
end

See Also

Authors

<< get_serialusb USB Device Strings