<< get_productusb USB Device Strings get_stringusb >>

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

get_serialusb

Get The Serial Number String from a USB device.

Calling Sequence

[serial_string,serial_success]=get_serialusb(comu_type)

Parameters

serial_string
: string A wide string
serial_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 The Serial Number String from a USB device. Scilab macro's for hid_get_serial

This is a macro designed to use the hid_get_serial

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
[serial_string,serial_success]=get_serialusb("hid")
if ( serial_success < 0 ) then
     disp("unable to get serial string");
     close_success=closeusb("hid");
     exit_success=exitusb("hid");
     return
else
     disp(serial_string);
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_productusb USB Device Strings get_stringusb >>