c++ - libusb: What is the source of these read errors? -


i sending english alphabets 1 second delay arduino laptop:

void loop()  {     delay(1000);     serial.write('n');   } 

i trying catch , print alphabets c++ program using libusb. here relevant part of code:

while(1) {         r = libusb_bulk_transfer(dev_handle, 131, data, 1, &actual, 0);          if(r == 0 && actual == 1) //we read 1 byte                 cout<<"read successful! data recieved "<<data[0]<<endl;         else                 cout<<"read error! return value: "<<r                     <<"actual  bytes recieved = "<<actual<<endl;  } 

this output get:

read successful! data recieved read error! return value: 0actual  bytes recieved = 0 read successful! data recieved b read successful! data recieved c read successful! data recieved d read error! return value: 0actual  bytes recieved = 0 read successful! data recieved e read error! return value: 0actual  bytes recieved = 0 read successful! data recieved f read error! return value: 0actual  bytes recieved = 0 read successful! data recieved g read error! return value: 0actual  bytes recieved = 0 read successful! data recieved h read error! return value: 0actual  bytes recieved = 0 read successful! data recieved read error! return value: 0actual  bytes recieved = 0 read successful! data recieved j read error! return value: 0actual  bytes recieved = 0 read successful! data recieved k read error! return value: 0actual  bytes recieved = 0 read successful! data recieved l read error! return value: 0actual  bytes recieved = 0 read successful! data recieved m read error! return value: 0actual  bytes recieved = 0 read successful! data recieved n read error! return value: 0actual  bytes recieved = 0 read successful! data recieved o read successful! data recieved p read error! return value: 0actual  bytes recieved = 0 read successful! data recieved q read error! return value: 0actual  bytes recieved = 0 

i observe each second arduino sends alphabet , program catches without fail. time, read error printed on screen along captured object. causing this, , how can stop it?

i've found source code of serial.write() here, can't make sense out of it.


Comments

Popular posts from this blog

javascript - Bootstrap Popover: iOS Safari strange behaviour -

Website Login Issue developed in magento -

Can the constants be defined inside a model file of a framework in PHP? -