<< bulk_get_product BULK Device Strings bulk_get_string >>

USB Comunication Toolbox for Scilab >> BULK with libusb-1.0 Library > BULK Device Strings > bulk_get_serial

bulk_get_serial

Get The Serial Number String from a USB device.

Calling Sequence

[serial_string,serial_success]=bulk_get_serial()

Parameters

serial_string
: string A wide string
serial_success
: This function returns 0 on success and -1 on error

Description

Get The Serial Number String from a USB device.

Examples

clc
VendorID="04D8";
ProductID="0204";
VendorID=uint16(hex2dec(VendorID));
ProductID=uint16(hex2dec(ProductID));
init_success=bulk_init();
if ( init_success < 0 ) then
   disp("unable to initialize the Libusb-1.0 Library");
   return
else
     disp("Libusb-1.0 Library initialized");
end
open_success=bulk_open(VendorID,ProductID);
if ( open_success < 0 ) then
     disp("unable to open device");
     return
else
     disp("Device Open");
end
[serial_string,serial_success]=bulk_get_serial()
if ( serial_success < 0 ) then
     disp("unable to get serial string");
     close_success=bulk_close();
     exit_success=bulk_exit();
     return
else
     disp(serial_string);
end
close_success=bulk_close();  
if ( close_success < 0 ) then
   disp("unable to closed device");
else
   disp("device closed");
end
exit_success=bulk_exit();
if ( exit_success < 0 ) then
   disp("unable to free static data associated with Libusb-1.0 Library");
   return
else
   disp("Libusb-1.0 Library have been freed all of the static data associated");
end

See Also

Authors

<< bulk_get_product BULK Device Strings bulk_get_string >>