Block or unblock the reading process
nonblocking_success=hid_set_nonblocking(_block);
Set the non blocking state to the device's handle
With this function the user can activate or deactivate the non blocking feacture of the reading proccess. If the feacture is deactivate the reading process will not wait for data in the usb port to be read. Otherwise the reading process wait until the data arrive to the respective usb port.
n=5; txBuff=init_buff(n); for i=1:n txBuff=setBuffValue(txBuff,i,i); end VendorID="04D8"; ProductID="010B"; VendorID=uint16(hex2dec(VendorID)); ProductID=uint16(hex2dec(ProductID)); init_success=hid_init(); if ( init_success < 0 ) then disp("unable to initialize the HIDAPI Library"); return else disp("HIDAPI Library initialized"); end open_success=hid_open(VendorID,ProductID); if ( open_success < 0 ) then disp("unable to open device"); return else disp("device open"); end nonblocking_success=hid_set_nonblocking(%t); if ( nonblocking_success < 0 ) then disp("unable to set nonblocking"); else disp("device have been set nonblocking"); end close_success=hid_close(); if ( close_success < 0 ) then disp("unable to closed device"); else disp("device closed"); end exit_success=hid_exit(); 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 | ![]() | ![]() |