From ff44609befc0b1c0ab024bffd48bbbe55da4e533 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Tue, 13 Oct 2015 14:12:45 +1000 Subject: [PATCH] hidpp10: use the directory profile count to get the device info The G700 has 5 available profiles, bump HIDPP10_NUM_PROFILES. On the other hand, hidpp10_get_device_info() doesn't fill anything... Signed-off-by: Peter Hutterer Signed-off-by: Benjamin Tissoires --- src/hidpp10.c | 6 +++++- src/hidpp10.h | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/hidpp10.c b/src/hidpp10.c index 23f2e024..be894f59 100644 --- a/src/hidpp10.c +++ b/src/hidpp10.c @@ -1440,6 +1440,8 @@ hidpp10_get_device_info(struct hidpp10_device *dev) enum hidpp10_led_status led[6]; int8_t current_profile; struct hidpp10_profile profiles[HIDPP10_NUM_PROFILES]; + int count; + struct hidpp10_directory directory[16]; hidpp10_get_individual_features(dev, &feature_mask); hidpp10_get_hidpp_notifications(dev, ¬ifications); @@ -1452,7 +1454,9 @@ hidpp10_get_device_info(struct hidpp10_device *dev) hidpp10_get_current_profile(dev, ¤t_profile); - for (i = 0; i < HIDPP10_NUM_PROFILES; i++) + count = hidpp10_get_profile_directory(dev, directory, + ARRAY_LENGTH(directory)); + for (i = 0; i < count && i < HIDPP10_NUM_PROFILES; i++) hidpp10_get_profile(dev, i, &profiles[i]); return 0; diff --git a/src/hidpp10.h b/src/hidpp10.h index 2b85b3af..98152fb5 100644 --- a/src/hidpp10.h +++ b/src/hidpp10.h @@ -36,7 +36,7 @@ /* FIXME: that's what my G500s supports, but only pages 3-5 are valid. * 0 is zeroed, 1 and 2 are garbage, all above 6 is garbage */ -#define HIDPP10_NUM_PROFILES 3 +#define HIDPP10_NUM_PROFILES 5 #define HIDPP10_MAX_PAGE_NUMBER 31