hog-lib: Make use of UHID_CREATE2
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Tue, 18 Jan 2022 23:45:17 +0000 (15:45 -0800)
committerAyush Garg <ayush.garg@samsung.com>
Mon, 15 May 2023 09:25:53 +0000 (14:55 +0530)
commitad634c8d45a4589167f36458ab8f1fba39854fac
tree4b3ceeb25229c66bbc5d4c59eec4cf78794d1d13
parentbec761fb50c5cebcbfb387b6afb3f534ddd24540
hog-lib: Make use of UHID_CREATE2

This convert the use of UHID_CREATE to UHID_CREATE2 which gives back
the information of reports being numbered or not thus avoiding the need
to parse the report map in order to check if there are a report number
on them since UHID_START gives that information:

UHID_START:
  This is sent when the HID device is started. Consider this as an
  answer to UHID_CREATE2. This is always the first event that is sent.
  Note that this event might not be available immediately after
  write(UHID_CREATE2) returns.
  Device drivers might require delayed setups.
  This event contains a payload of type uhid_start_req. The "dev_flags"
  field describes special behaviors of a device. The following flags
  are defined:

      - UHID_DEV_NUMBERED_FEATURE_REPORTS
      - UHID_DEV_NUMBERED_OUTPUT_REPORTS
      - UHID_DEV_NUMBERED_INPUT_REPORTS

  Each of these flags defines whether a given report-type uses numbered
  reports. If numbered reports are used for a type, all messages from
  the kernel already have the report-number as prefix. Otherwise, no
  prefix is added by the kernel. For messages sent by user-space to the
  kernel, you must adjust the prefixes according to these flags

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
profiles/input/hog-lib.c