Scilab macro's for hid_read
[rxBuff,read_success]=readusb(_size,comu_type)
Read or receive a buffer from an USB HID Device. Scilab macro's for hid_read
This is a macro designed to use the hid_read
The "bulk", "iso" and "cdc" implementantion are missing
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 write_success=writeusb(txBuff,n,"hid"); if ( write_success < 0 ) then disp("unable to write device"); else disp("device have been written"); end nonblocking_success=hid_set_nonblocking(%f); if ( nonblocking_success < 0 ) then disp("unable to set nonblocking"); else disp("device have been set nonblocking"); end [rxBuff,read_success]=readusb(n,"hid"); if ( read_success < 0 ) then disp("unable to read device"); else disp("device have been read"); disp(rxBuff); 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 | ![]() | ![]() |