usb_hid: also use user_memcpy() in TabletProtocolHandler.
This commit is contained in:
parent
e0c304f798
commit
3da236362c
@ -18,6 +18,7 @@
|
|||||||
#include "HIDReportItem.h"
|
#include "HIDReportItem.h"
|
||||||
|
|
||||||
#include <new>
|
#include <new>
|
||||||
|
#include <kernel.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <usb/USB_hid.h>
|
#include <usb/USB_hid.h>
|
||||||
|
|
||||||
@ -189,8 +190,16 @@ TabletProtocolHandler::Control(uint32 *cookie, uint32 op, void *buffer,
|
|||||||
return B_BUFFER_OVERFLOW;
|
return B_BUFFER_OVERFLOW;
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
status_t result = _ReadReport(buffer, cookie);
|
tablet_movement movement;
|
||||||
if (result != B_INTERRUPTED)
|
status_t result = _ReadReport(&movement, cookie);
|
||||||
|
if (result == B_INTERRUPTED)
|
||||||
|
continue;
|
||||||
|
if (!IS_USER_ADDRESS(buffer)
|
||||||
|
|| user_memcpy(buffer, &movement, sizeof(movement))
|
||||||
|
!= B_OK) {
|
||||||
|
return B_BAD_ADDRESS;
|
||||||
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -205,12 +214,13 @@ TabletProtocolHandler::Control(uint32 *cookie, uint32 op, void *buffer,
|
|||||||
}
|
}
|
||||||
|
|
||||||
case MS_SET_CLICKSPEED:
|
case MS_SET_CLICKSPEED:
|
||||||
#ifdef __HAIKU__
|
if (!IS_USER_ADDRESS(buffer)
|
||||||
return user_memcpy(&fClickSpeed, buffer, sizeof(bigtime_t));
|
|| user_memcpy(&fClickSpeed, buffer, sizeof(bigtime_t))
|
||||||
#else
|
!= B_OK) {
|
||||||
fClickSpeed = *(bigtime_t *)buffer;
|
return B_BAD_ADDRESS;
|
||||||
|
}
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
|
Loading…
Reference in New Issue
Block a user