felHR85 / UsbSerial

Usb serial controller for Android
MIT License
1.78k stars 582 forks source link

Read Thread takes more time reading large bytes #308

Closed sivaprashanth closed 4 years ago

sivaprashanth commented 4 years ago

First i connect serially with the streams example as shown, then once i create a status timer as shown below the usb device stops reading :
if (status_timer != null) return; status_timer = new Timer(); TimerTask updateProfile = new StatusTimerTask(this); Log.d(TAG2,"Status Timer created"); Global gs = (Global) getApplication(); if(!gs.mQblockSettings.isUSBMode) status_timer.scheduleAtFixedRate(updateProfile, 0, 200); else status_timer.scheduleAtFixedRate(updateProfile, 10, 1000);

i saw that if i disconnect the usb from the device the read thread again starts back. I infered this through my log messages.Anyone have any idea about it please help me.

sivaprashanth commented 4 years ago

but somehow if i start my timertask after the connection has been made then it works fine. I dont know whether the timer is stopping the service thread or not.

sivaprashanth commented 4 years ago

i am reading 1024 bytes of information as a stream. it seems to take a minute to read them at baud rate 9600. i am using aysn api with chipset CH34X device. is there another approach to read the thread faster?

sivaprashanth commented 4 years ago

the issue is with the baud rate. changing the baud rate 115200 worked fine with this library itself.