<< BULK Basic's commands BULK Basic's commands bulk_exit >>

USB Comunication Toolbox for Scilab >> BULK with libusb-1.0 Library > BULK Basic's commands > bulk_close

bulk_close

Close an USB Device Opened

Calling Sequence

close_success = bulk_close()

Parameters

close_success
: retun 0 if device has been closed and -1 if the device can not be closed.

Description

Close an USB Device Open

Once the USB Device have been opened, the bulk_close() closed the device and release the memory used for the internal handle. If an USB Device have been opened its necesary close it when the comunication is over.

If the device its not closed once have been opened Scilab, eventualy, will crash down because a segmentation fault

Examples

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 Libusb-1.0 Library");
   return
else
  disp("Libusb-1.0 Library initialized");
end
open_success=hid_open(VendorID,ProductID);
if ( open_success < 0 ) then
   disp("unable to open device");
   return
else
   disp("device open"); 
   close_success=hid_close();
end
exit_success=hid_exit();
if ( init_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 Basic's commands BULK Basic's commands bulk_exit >>