1
0
forked from drath/libratbag

hidpp20: change hidpp20_onboard_profiles_read_memory API

It looks like we can not use a section > 0xff and that the first
parameter corresponds to the type of the available memory (rom or flash).

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
This commit is contained in:
Benjamin Tissoires
2015-10-14 16:51:19 -04:00
parent 3294c5c048
commit d3abebf202

View File

@@ -935,9 +935,10 @@ int hidpp20_adjustable_dpi_set_sensor_dpi(struct hidpp20_device *device,
static int
hidpp20_onboard_profiles_read_memory(struct hidpp20_device *device,
uint16_t page,
uint16_t section,
uint8_t *result)
uint8_t read_rom,
uint8_t page,
uint8_t section,
uint8_t result[16])
{
uint8_t feature_index;
int rc;
@@ -945,12 +946,15 @@ hidpp20_onboard_profiles_read_memory(struct hidpp20_device *device,
.msg.report_id = REPORT_ID_LONG,
.msg.device_idx = device->index,
.msg.address = CMD_ONBOARD_PROFILES_MEMORY_READ,
.msg.parameters[0] = page >> 8,
.msg.parameters[1] = page & 0xFF,
.msg.parameters[2] = section >> 8,
.msg.parameters[3] = section & 0xFF,
.msg.parameters[0] = read_rom,
.msg.parameters[1] = page,
.msg.parameters[2] = 0,
.msg.parameters[3] = section,
};
if (read_rom > 1)
return -EINVAL;
feature_index = hidpp_root_get_feature_idx(device,
HIDPP_PAGE_ONBOARD_PROFILES);
if (feature_index == 0)
@@ -1037,8 +1041,9 @@ hidpp20_onboard_profiles_allocate(struct hidpp20_device *device,
unsigned profile_count = 0;
rc = hidpp20_onboard_profiles_read_memory(device,
0x0000,
0x0000,
0x00,
0x00,
0x00,
data);
if (rc < 0)
return rc;
@@ -1079,6 +1084,7 @@ int hidpp20_onboard_profiles_read(struct hidpp20_device *device,
for (i = 0; i < HIDPP20_PROFILE_SIZE / 0x10; i++) {
rc = hidpp20_onboard_profiles_read_memory(device,
0,
index + 1,
i * 0x10,
data + i * 0x10);