cAT
cAT copied to clipboard
Add CAT_STATUS_AGAIN to report io::[write|read] can't send or receive more data
The main idea behind returning BUSY state when can't send out character is related with sleep and low power modes. The main service function should return OK only when there is nothing to do (no pending read/write characters, no pending operations, and etc...). Many applications and projects use it so this is not backward-compatible change.
The main idea behind returning BUSY state when can't send out character is related with sleep and low power modes. The main service function should return OK only when there is nothing to do (no pending read/write characters, no pending operations, and etc...). Many applications and projects use it so this is not backward-compatible change.
The return from cat_io_interface::write doesn't equal to 1 mean that the low level can't accept more character(e.g. when fd is set to non-blocking mode, write will return -EAGAIN in this case). Application need to know this state to avoid the busy loop.
So maybe it should return BUSY_WRITE (add new state) to distinguish this state from BUSY and OK ?
So maybe it should return BUSY_WRITE (add new state) to distinguish this state from BUSY and OK ?
Add CAT_STATUS_AGAIN(mimic non blocking io return AGAIN) to indicate this situation.
So now, in which case the main service function will return OK instead of BUSY or AGAIN? This change needs to fix tests also, because the logic will change.
Yes, I will find time to ensure all test pass.