<< exitusb USB Basic's commands openusb >>

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

initusb

Scilab macro's for hid_init

Calling Sequence

init_success=initusb(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
init_success
: This function returns 0 on success and -1 on error.

Description

Scilab macro's for hid_init()

This function initializes the HIDAPI library. Calling it is not strictly necessary, as it will be called automatically by hid_enumerate and any of the hid_open_*() functions (internal funtions of the library), if it is needed. This function should be called at the beginning of execution however, if there is a chance of HIDAPI handles being opened by different threads simultaneously.

This is a macro designed to use the hid_init

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
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

<< exitusb USB Basic's commands openusb >>