mik3y / usb-serial-for-android

Android USB host serial driver library for CDC, FTDI, Arduino and other devices.
MIT License
4.85k stars 1.59k forks source link

Read the prompt #550

Closed tonnqueiroz closed 8 months ago

tonnqueiroz commented 10 months ago

Is it possible to read the returned prompt before or after sending each command?

kai-morich commented 10 months ago

Not clear to me, what you are looking for. You can use direct read or event driven read as mentioned in readme

tonnqueiroz commented 10 months ago

@kai-morich I need to automate the sending of commands to routers from several different manufacturers. Below I illustrate the prompts for routers manufactured by HUAWEI. Based on each prompt, my automation should send a different command, so I need to be able to read the prompt!

New Username: Password: Confirm password: Username: Password: < Huawei > [ Huawei ]

kai-morich commented 10 months ago

read the response with direct read or event driven read as mentioned in readme, then send different next command

Uditk2002 commented 9 months ago

Hi @kai-morich @tonnqueiroz direct read.. is mentioned inside the read() method, if I am right. Even if I call read() as soon as I write it reads 0 bytes. I tried adding delay but still, each and every command that is sent one at a time is recieved or may be appended (late) in the textbox after everything is sent!! . I have the same goal as @tonnqueiroz does. I am a newbie to android programming. Your help would really mean a lot. Thankyou

kai-morich commented 9 months ago

see https://github.com/mik3y/usb-serial-for-android/wiki/FAQ#user-content-When_reading_a_message_why_dont_all_bytes_arrive_at_the_same_time