forked from drath/libratbag
asus: check mouse in probe, fix asus status code
This commit is contained in:
@@ -136,7 +136,7 @@ asus_query(struct ratbag_device *device,
|
||||
return rc;
|
||||
|
||||
/* invalid state, disconnected or sleeping */
|
||||
if (response->data.code == 0xaaff) {
|
||||
if (response->data.code == ASUS_STATUS_ERROR) {
|
||||
return ASUS_STATUS_ERROR;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#define ASUS_BUTTON_ACTION_TYPE_KEY 0 /* keyboard key */
|
||||
#define ASUS_BUTTON_ACTION_TYPE_BUTTON 1 /* mouse button */
|
||||
#define ASUS_BUTTON_CODE_DISABLED 0xff /* disabled mouse button */
|
||||
#define ASUS_STATUS_ERROR 0xffaa /* invalid state/request, disconnected or sleeping */
|
||||
#define ASUS_STATUS_ERROR 0xaaff /* invalid state/request, disconnected or sleeping */
|
||||
|
||||
/* maximum number of buttons across all ASUS devices */
|
||||
#define ASUS_MAX_NUM_BUTTON 17
|
||||
|
||||
@@ -434,6 +434,7 @@ asus_driver_probe(struct ratbag_device *device)
|
||||
unsigned int profile_count, dpi_count, button_count, led_count;
|
||||
const struct asus_button *asus_button;
|
||||
struct asus_data *drv_data;
|
||||
struct asus_profile_data profile_data;
|
||||
struct ratbag_profile *profile;
|
||||
struct ratbag_button *button;
|
||||
struct ratbag_resolution *resolution;
|
||||
@@ -443,6 +444,12 @@ asus_driver_probe(struct ratbag_device *device)
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
rc = asus_get_profile_data(device, &profile_data);
|
||||
if (rc) {
|
||||
ratbag_close_hidraw(device);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
/* create device state data */
|
||||
drv_data = zalloc(sizeof(*drv_data));
|
||||
ratbag_set_drv_data(device, drv_data);
|
||||
|
||||
Reference in New Issue
Block a user