Hi Jefe, You can use ux_host_class_hid_mouse_position_get function. See an example below: static UX_HOST_CLASS_HID * g_hid; UINT ux_host_event_callback(ULONG event, UX_HOST_CLASS * p_host_class, VOID * p_instance) { UINT status; UX_HOST_CLASS * hid_class; if ((ULONG) UX_DEVICE_INSERTION == event) { status = ux_host_stack_class_get(_ux_system_host_class_hid_name, &hid_class); if ((UINT) UX_SUCCESS == status) { if (hid_class == p_host_class) { if (NULL == g_hid) { g_hid = p_instance; while (g_hid->ux_host_class_hid_state != (ULONG) UX_HOST_CLASS_INSTANCE_LIVE) { tx_thread_sleep(1); } while (g_hid->ux_host_class_hid_client->ux_host_class_hid_client_status != (ULONG) UX_HOST_CLASS_INSTANCE_LIVE) { tx_thread_sleep(1); } } } } } else if((ULONG) UX_DEVICE_REMOVAL == event) { if (p_instance == g_hid) { g_hid = NULL; } } else { } return (UINT) UX_SUCCESS; } void new_thread_entry(void) { SLONG pos_x; SLONG pos_y; UINT status; while (1) { status = ux_host_class_hid_mouse_position_get(g_hid, &pos_x, &pos_y); if (UX_SUCCESS == status) { // process pos_x and pos_y } tx_thread_sleep(5); } } Regards, adboc
↧