<< USB Basic's commands USB Basic's commands exitusb >>

USB Comunication Toolbox for Scilab >> Scilab Macros > USB Basic's commands > closeusb

closeusb

Scilab macro's for hid_close

Calling Sequence

close_success=closeusb(comu_type)

Parameters

comu_type
: Comunication protocol comunication. This string identify which protocol use. HID, Bulk, Isochronous or CDC "hid", "bulk", "iso" and "cdc" respectively
close_success
: retun 0 if device has been closed and -1 if the device can not be closed.

Description

Close an USB HID Device Open. Set the non blocking state to the device's handle. Scilab macro's for hid_close

This is a macro designed to use the hid_close

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

Examples

n=5;
txBuff=init_buff(n);
for i=1:n
    txBuff=setBuffValue(txBuff,i,i);
end
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("04D8","010B","hid");
if ( open_success < 0 ) then
   disp("unable to open device");
   return
else
   disp("device open");
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 ( init_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

<< USB Basic's commands USB Basic's commands exitusb >>