tools: editor: keep a copy of the original report descriptor

Useful if we want to amend all the previous changes.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
tools: editor: overwrite the current file

Now that we save the old report descriptor, we can safely overwrite the
current file.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
tools: usbmon2hid-replay: allow descriptors to be chained

the configuration descriptor of a usb device can caontain several
chained configuration descriptors. Allow the tool to parse such descpritors
(where the total size > content of first byte)

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
tools: usbmon2hid-replay: properly associate events to report descriptors

the previous implementation did not worked. Actually, the endpoint number
has nothing to do with the HID interface, so we need a mapping for those.
This is done by parsing the configuration descriptor.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
tools: usbmon2hid-replay: add hid-replay style name where needed

and where available

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
tools: usbmon2hid-replay: use optparse

we will need it, so use it

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
tools: usbmon2hid-replay: add --intf option

--intf allow to filter the actual interface emitting the events.
When a device presents USB several interfaces, this can be used to filter
out the interfaces we don't care.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
tools: parse_rdesc: add data_txt() to ReportDescriptor

used when you want to retrieve the descriptor in a hexadecimal string.

Reuse it where possible in the file too.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
tools: parse_rdesc: for kernel outputs, do not append the index

This is not easy to see the changes when edited in git diff.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Merge branch 'master' into hid-offset
tools: parse_hid: add the current key to the events

If the report ID is overwritten by the protocol, this is a useful
information to get.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
tools: parse_hid: implement new intuos key mapping for usage 00be0005

Currently no other possibilities, and it's working quite well.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>