Skip to content

Commit

Permalink
Revert "HID: logitech: Add function to enable HID++ 1.0 "scrolling ac…
Browse files Browse the repository at this point in the history
…celeration""

This reverts commit 051dc9b.

It turns out the current API is not that compatible with
some Microsoft mice, so better start again from scratch.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Acked-by: Harry Cutts <hcutts@chromium.org>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Acked-by: Jiri Kosina <jkosina@suse.cz>
  • Loading branch information
Benjamin Tissoires committed Nov 22, 2018
1 parent 5372fc3 commit 00acc9e
Showing 1 changed file with 13 additions and 34 deletions.
47 changes: 13 additions & 34 deletions drivers/hid/hid-logitech-hidpp.c
Original file line number Diff line number Diff line change
Expand Up @@ -400,53 +400,32 @@ static void hidpp_prefix_name(char **name, int name_length)
#define HIDPP_SET_LONG_REGISTER 0x82
#define HIDPP_GET_LONG_REGISTER 0x83

/**
* hidpp10_set_register_bit() - Sets a single bit in a HID++ 1.0 register.
* @hidpp_dev: the device to set the register on.
* @register_address: the address of the register to modify.
* @byte: the byte of the register to modify. Should be less than 3.
* Return: 0 if successful, otherwise a negative error code.
*/
static int hidpp10_set_register_bit(struct hidpp_device *hidpp_dev,
u8 register_address, u8 byte, u8 bit)
#define HIDPP_REG_GENERAL 0x00

static int hidpp10_enable_battery_reporting(struct hidpp_device *hidpp_dev)
{
struct hidpp_report response;
int ret;
u8 params[3] = { 0 };

ret = hidpp_send_rap_command_sync(hidpp_dev,
REPORT_ID_HIDPP_SHORT,
HIDPP_GET_REGISTER,
register_address,
NULL, 0, &response);
REPORT_ID_HIDPP_SHORT,
HIDPP_GET_REGISTER,
HIDPP_REG_GENERAL,
NULL, 0, &response);
if (ret)
return ret;

memcpy(params, response.rap.params, 3);

params[byte] |= BIT(bit);
/* Set the battery bit */
params[0] |= BIT(4);

return hidpp_send_rap_command_sync(hidpp_dev,
REPORT_ID_HIDPP_SHORT,
HIDPP_SET_REGISTER,
register_address,
params, 3, &response);
}


#define HIDPP_REG_GENERAL 0x00

static int hidpp10_enable_battery_reporting(struct hidpp_device *hidpp_dev)
{
return hidpp10_set_register_bit(hidpp_dev, HIDPP_REG_GENERAL, 0, 4);
}

#define HIDPP_REG_FEATURES 0x01

/* On HID++ 1.0 devices, high-res scroll was called "scrolling acceleration". */
static int hidpp10_enable_scrolling_acceleration(struct hidpp_device *hidpp_dev)
{
return hidpp10_set_register_bit(hidpp_dev, HIDPP_REG_FEATURES, 0, 6);
REPORT_ID_HIDPP_SHORT,
HIDPP_SET_REGISTER,
HIDPP_REG_GENERAL,
params, 3, &response);
}

#define HIDPP_REG_BATTERY_STATUS 0x07
Expand Down

0 comments on commit 00acc9e

Please sign in to comment.