<< initusb USB Basic's commands read_timeoutusb >>

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

openusb

Scilab macro's for hid_open

Calling Sequence

open_success=openusb(VendorID,ProductID, comu_type);

Parameters

VendorID
: Vendor Identification of the USB device' s manufacturer. This number its unique for every USB manufacturer
ProductID
: Product Identification of the USB device. This number its define by the USB manufacturer.
comu_type
: Comunication protocol comunication. This string identify which protocol use. HID, Bulk, Isochronous or CDC "hid", "bulk", "iso" and "cdc" respectively
open_success
: retun 0 if device has been opened and -1 if the device can not be opened. Check the USB HID device is properly connected to the host computer.

Description

Open HID USB Device. Scilab macro's for hid_open

This is a macro designed to use the hid_open

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

<< initusb USB Basic's commands read_timeoutusb >>