input mouse: Handle B_BAD_DATA status code
The intended behaviour for this is when a kerned driver responds with B_BAD_DATA status code is any data comming out should not be taken into account and not trigger a device restart. By providing this, device drivers have a way to communicate to the user space something is not completely right comming out from the hardware such as checksum issues, debounce packets that need to be ignored, palm detention filters, partial processed information requiring extra packets, detected incorrect data, partlially or completelly uninitilised data, etc. A potential workaround for device drivers is the usage of B_TIMED_OUT which currently has part of the same code path but as the intention for the naming it's not the same, there is no warranty that in the near future the code path here will not diverge. This fixes many misbehavious as per description above when drivers only deal with B_OK or B_ERROR return codes. The first telling userspace to process wrong data and the latter by issuing a device restart. Change-Id: Ic57df649ba0972a60004db3d2b3aeebdeb65e133 Reviewed-on: https://review.haiku-os.org/c/haiku/+/9905 Reviewed-by: waddlesplash <[email protected]> Tested-by: Commit checker robot <[email protected]> Reviewed-by: nephele nephele <[email protected]>
This commit is contained in:
committed by
waddlesplash
parent
9c5da6de53
commit
7ae2e6756b
@@ -439,14 +439,14 @@ MouseDevice::_ControlThread()
|
||||
status_t status = ioctl(fDevice, MS_READ_TOUCHPAD, &read, sizeof(read));
|
||||
if (status < 0)
|
||||
status = errno;
|
||||
if (status != B_OK && status != B_INTERRUPTED && status != B_TIMED_OUT) {
|
||||
if (status == B_TIMED_OUT || status == B_BAD_DATA) {
|
||||
read.event = MS_READ_TOUCHPAD;
|
||||
read.u.touchpad = lastTouchpadMovement;
|
||||
} else if (status != B_OK && status != B_INTERRUPTED) {
|
||||
LOG_ERR("Mouse (touchpad) device exiting, %s\n", strerror(errno));
|
||||
_ControlThreadCleanup();
|
||||
// TOAST!
|
||||
return;
|
||||
} else if (status == B_TIMED_OUT) {
|
||||
read.event = MS_READ_TOUCHPAD;
|
||||
read.u.touchpad = lastTouchpadMovement;
|
||||
}
|
||||
|
||||
if (read.event == MS_READ_TOUCHPAD) {
|
||||
|
||||
Reference in New Issue
Block a user