<< hid_get_serial HID Device Strings Microchip MCU 18F4550 Example >>

USB Comunication Toolbox for Scilab >> HIDAPI Library > HID Device Strings > hid_get_string

hid_get_string

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

Calling Sequence

[indexed_string,string_success]=hid_get_string(index_pos)

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

Description

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

Examples

clc
VendorID="04D8";
ProductID="900A";
VendorID=uint16(hex2dec(VendorID));
ProductID=uint16(hex2dec(ProductID));
init_success=hid_init();
if ( init_success < 0 ) then
   disp("unable to initialize the HIDAPI Library");
   return
else
     disp("HIDAPI Library initialized");
end
open_success=hid_open(VendorID,ProductID);
if ( open_success < 0 ) then
     disp("unable to open device");
     return
else
     disp("Device Open");
end
for i=1:3
    [indexed_string,string_success]=hid_get_string(uint16(i))
    if ( string_success < 0 ) then
         disp("unable to get indexed string");
         close_success=hid_close();
         exit_success=hid_exit();
         return
    else
         disp(indexed_string);
    end    
end
close_success=hid_close();  
if ( close_success < 0 ) then
   disp("unable to closed device");
else
   disp("device closed");
end
exit_success=hid_exit();
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

<< hid_get_serial HID Device Strings Microchip MCU 18F4550 Example >>