in optiboot, is getch() a timed read operation ?

I am developing a custom bootloader based on Optiboot, to upload firmware Over the Air using GSM module.

Now, when the bootloader is run, I want to check if there is any incoming data from the GSM module on the SOFT_UART.

But as of now, it seems to me that the bootloader would get stuck in getch() function if there is no incoming bytes on the RX line of SOFT_UART.

So, I think that making the getch() a timed read operation would suffice for my need.

Can anyone guide me in the right direction on making getch() a timed read for SOFT_UART.

Thanks,
Rahul

Can anyone guide me in the right direction on making getch() a timed read for SOFT_UART.

Why do you need to change the behavior of getch()? Surely the optiboot bootloader already knows not to wait forever for data.

It seems that I didn't explain the scenario ..

So, here we go
The binary file of the firmwar is already downloaded and saved into the GSM module,
Now, the mcu gets reset, and enters into the bootloader.

Now, to get in sync with the GSM module, it will check for any incoming char on the RX line, if not than than it would be initiating a handshake with GSM module, using AT command, to which if we get reply "OK\r\n" than only further action would be taken..

I know that if there is no data on the RX line, than getch() would cause a watchdogReset() and the mcu will reset, which I don't want..