aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-usb-hid.c
AgeCommit message (Collapse)AuthorFilesLines
2022-09-27USB HID: Always use a format string.Gerald Combs1-7/+11
Ensure that the second argument to wmem_strdup_printf is always a format string. Fixes #18384.
2022-05-22Some check_typed_item_calls.py warning fixes.Martin Mathieson1-1/+1
2022-03-07USB HID: Initialize some variables.Gerald Combs1-4/+4
Fixes #17984.
2021-09-29USBHID: Add integer representation of data bits without specific parsing.Berk Akinci1-4/+8
Also changing keyboard and button disssectors to prefix values with ": ". This matches how proto_tree_add_int_bits_format_value() displays values. Concludes the last bits left: Closes #17550
2021-09-26USB HID: Parse bit fields with correct bit orderTomasz Moń1-39/+13
Implement little endian support for tvb_get_bits family of functions. The big/little endian refers to bit numbering within an octet. In big endian, the most significant bit is considered bit 0, while in little endian the least significant bit is considered bit 0. Add encoding parameters to proto tree bits format family functions. Specify ENC_BIG_ENDIAN in all dissectors using these functions except in USB HID that requires ENC_LITTLE_ENDIAN to work correctly. When formatting bits values, always display most significant bit on the leftmost position regardless of the encoding. This results in no gaps between octets and makes the displayed value comprehensible. Close #4478 Fix #17014
2021-09-10USB HID: Handle different usage pages in fieldsTomasz Moń1-194/+188
Replace custom keyboard page array handling with generic array handler.
2021-09-10USB HID: Support extended usages in descriptorsTomasz Moń1-16/+56
Usage, Usage Minimum and Usage Maximum can be "Extended" Usages. When parsing report descriptor, respect page encoded in extended usage value. Remove arbitrary usage count limit, as the usage ranges are limited to 16-bit value and thus the usages array can grow by up by 256 KiB with single usage range.
2021-08-31USBHID: Report Descriptor: Fix Push and Pop global item parsing.Berk Akinci1-4/+10
Still to do: fix the corresponding HID data parsing.
2021-08-29USB HID: Fix Usage Maximum typoBerk Akinci1-4/+2
Fix typo preventing 'Usage Maximum' values from being parsed. Values were were reported as 'Usage:'.
2021-08-29USB HID: Update to match HID Usage Tables version 1.22Berk Akinci1-206/+534
Add camera control page (0x90). Usages are up to date with HID Usage Tables for USB version 1.22.
2021-07-27Change some `wmem_packet_scope()` to `pinfo->pool`David Perry1-5/+5
2021-02-02Address more non-static, non-shared symbols.Martin Mathieson1-1/+1
2021-01-26USB HID: Avoid allocating a huge amount of memory (second try).Gerald Combs1-0/+5
10204490d7 / MR 80 ensured that we didn't grow field.usages due to an underflow, but it neglected to check for a sane array size. Add another check to make sure we don't wmem_array_grow() too much. Fixes #17165 and fixes #16809 more completely.
2021-01-26USB HID: Fix a memory leak.Gerald Combs1-3/+1
Replace mismatched g_strdup() + g_free()s with wmem_strdup_printf(wmem_packet_scope(), ...). Fixes #17124.
2020-12-10USB-HID: Tertiery is usually threeJaap Keuter1-1/+1
2020-12-03USB HID: Usage Minimum and Usage Maximum are inclusiveJohn Thacker1-3/+9
Usage Minimum and Usage Maximum are an inclusive, closed interval. This fixes an fencepost error where the Usage Maximum value was not being included as a possible value in the bitfield. Related to #17014
2020-10-23USB HID: Initialize a struct.Gerald Combs1-1/+1
Initialize a variable caught by Valgrind. Fixes #16938.
2020-10-15proto: add support for FT_BYTES in proto_tree_add_bitsFilipe Laíns1-5/+449
Change-Id: I5030d550bd760953ac84c2700bb0e03cc7a831a1 Signed-off-by: Filipe Laíns <lains@archlinux.org>
2020-09-07Yet more spelling fixes.Martin Mathieson1-1/+1
Includes small updates to the script and wireshark dictionary. Probably the last spelling fixes from me for a while.
2020-09-05Tools: Clean up checkAPI and add ui/qt.Gerald Combs1-6/+6
Remove the --check-addtext and --build flags. They were used for checkAddTextCalls, which was removed in e2735ecfdd. Add the sources in ui/qt except for qcustomplot.{cpp,h}. Fix issues in main.cpp, rtp_audio_stream.cpp, and wireshark_zip_helper.cpp. Rename "index"es in packet-usb-hid.c.
2020-09-02USB HID: Avoid allocating a huge amount of memory.Gerald Combs1-0/+3
Make sure we don't pass a huge number to wmem_array_grow. Closes #16809.
2020-09-01USB HID: Fix a double free.Gerald Combs1-0/+4
Make sure we allocate a new field.usages array for USBHID_MAINITEM_TAG_OUTPUT as we do for USBHID_MAINITEM_TAG_INPUT. Closes #16818.
2020-08-20USB HID: fail to parse the rdesc if it has mismatched report ID usageFilipe Laíns1-0/+6
If one field uses a report ID, all other should too. Otherwise we don't know if the first byte is a report ID or a data value. Change-Id: I84f5cde3f08c26d904d7c5f66e8d622b820b3f6c Signed-off-by: Filipe Laíns <lains@archlinux.org> Reviewed-on: https://code.wireshark.org/review/37781 Petri-Dish: Tomasz Moń <desowin@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-08-20USB HID: separate HID items into input and outputFilipe Laíns1-46/+87
Change-Id: I36c2eddb8ae227b28a26c86c87120e393d9a62b0 Signed-off-by: Filipe Laíns <lains@archlinux.org> Reviewed-on: https://code.wireshark.org/review/37828 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-07-07USB HID: fix memory leak when saving report descriptorsFilipe Laíns1-7/+14
Change-Id: I5cb5598be557823cf3b39cda30bed6febee297d3 Signed-off-by: Filipe Laíns <lains@archlinux.org> Reviewed-on: https://code.wireshark.org/review/37561 Petri-Dish: Tomasz Moń <desowin@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Tomasz Moń <desowin@gmail.com>
2020-07-07USB HID: fix parsing {logical ,phys }{min,max} in the report descriptorFilipe Laíns1-4/+4
Right now, for eg., a -32767/32767 min/max gets dissected as 0/1 which is wrong. Change-Id: Iffc649e0af4490827e722cae7f692ec4d0c245b8 Signed-off-by: Filipe Laíns <lains@archlinux.org> Reviewed-on: https://code.wireshark.org/review/37751 Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Tomasz Moń <desowin@gmail.com>
2020-07-07USB HID: introduce a report descriptor parserFilipe Laíns1-1/+235
Change-Id: Ief63059fc5009cf8eff903d14d1c4dd2f35728b6 Signed-off-by: Filipe Laíns <lains@archlinux.org> Reviewed-on: https://code.wireshark.org/review/37559 Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Tomasz Moń <desowin@gmail.com>
2020-06-25USB HID: skip re-saving report descriptorsFilipe Laíns1-1/+3
Change-Id: Ia88cf08cd7d05222f65c626ad6b526015851b543 Signed-off-by: Filipe Laíns <lains@archlinux.org> Reviewed-on: https://code.wireshark.org/review/37558 Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-06-25USB HID: fix saving the report descriptor bodyFilipe Laíns1-1/+1
Change-Id: I80b09d10e1435c90ac0c8534cc8e5e3ff0b4bda6 Signed-off-by: Filipe Laíns <lains@archlinux.org> Reviewed-on: https://code.wireshark.org/review/37557 Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-06-25USB HID: fix USAGE definition nameFilipe Laíns1-3/+3
This item is different from USAGE_PAGE, the correct name is USAGE. Change-Id: I22552391dc564184e5abf14456a94d06a6e7a908 Signed-off-by: Filipe Laíns <lains@archlinux.org> Reviewed-on: https://code.wireshark.org/review/37556 Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-06-09usb-hid: skip report descriptor if caller doesn't provide it.Dario Lombardo1-4/+6
Callers of this function (such as packet-btatt) can pass usb_conv_info = NULL. In this case just skip the storing of the report. Bug: 16589 Change-Id: I29e7a15d20def5ce90aa3e1b1b3b960f11949e59 Reviewed-on: https://code.wireshark.org/review/37368 Petri-Dish: Dario Lombardo <lomato@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Filipe Laíns <lains@archlinux.org> Reviewed-by: Tomasz Moń <desowin@gmail.com>
2020-06-01USB HID: annotate usbhid.dataFilipe Laíns1-8/+28
Change-Id: I283bab1ecdadc17589e2fbe944a457f5b5211970 Signed-off-by: Filipe Laíns <lains@archlinux.org> Reviewed-on: https://code.wireshark.org/review/37317 Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-05-27USB HID: introduce report_descriptors data structureFilipe Laíns1-0/+69
Change-Id: I2914f715860b7ae2eba311cd067a50b044b42928 Signed-off-by: Filipe Laíns <lains@archlinux.org> Reviewed-on: https://code.wireshark.org/review/37315 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-05-27USB HID: make usbhid.data bytesFilipe Laíns1-1/+1
Change-Id: Ib8544956a4138aca2b2157bf29cbde414ee3b388 Signed-off-by: Filipe Laíns <lains@archlinux.org> Reviewed-on: https://code.wireshark.org/review/37316 Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-03-23fix typo found by lintian (Unkown => Unknown)Alexis La Goutte1-1/+1
Change-Id: I32f636c5a8de652303fbe03668bf937004f2e6a8 Reviewed-on: https://code.wireshark.org/review/36543 Reviewed-by: Peter Wu <peter@lekensteyn.nl> Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Tomasz Moń <desowin@gmail.com>
2020-03-15USB HID: add missing usage pagesFilipe Laíns1-28/+850
- Haptics - Eye and Head Tracker - Sensor - Brailie Display - Lighting and Illumination - Gaming Device - FIDO Alliance Change-Id: I1e90bd8544b8327f376143226c7a1ea427c01277 Signed-off-by: Filipe Laíns <lains@archlinux.org> Reviewed-on: https://code.wireshark.org/review/36410 Petri-Dish: Tomasz Moń <desowin@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Tomasz Moń <desowin@gmail.com>
2020-03-15More modeline fixes to put HT tab stops every 8 characters.Guy Harris1-2/+2
Change-Id: If3ea65f24e33b89784b3d9a1e7009d09728d4f7a Reviewed-on: https://code.wireshark.org/review/36437 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2020-03-15Tab stops are always always always always always every 8 spaces.Guy Harris1-1/+1
That is the rule of UN*X, engraved on stone by Ken and Dennis, and there's plenty of software used to display and edit Wireshark source that hardwires the tab stops there.(including Boring Old cat And more). Pick any indent you want, but do *not* put tab stops every 4 spaces, even if putting them every 8 spaces requires you to hit your IDE over the head to accept that. Change-Id: I58f7c459ce2d72096f67e650afe74f2637f38649 Reviewed-on: https://code.wireshark.org/review/36434 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2020-03-15USB HID: update modelines to match the current code styleFilipe Laíns1-3/+3
Change-Id: Id106b1cc94038879a17970b5e9722f04bfb35df2 Signed-off-by: Filipe Laíns <lains@archlinux.org> Reviewed-on: https://code.wireshark.org/review/36423 Reviewed-by: Tomasz Moń <desowin@gmail.com>
2020-03-15USB HID: fix incorrect format string when annotating top level rdesc itemsFilipe Laíns1-5/+5
Change-Id: Iaac5f85e75e93278e2c485bd2e52756ac23f6e9a Signed-off-by: Filipe Laíns <lains@archlinux.org> Reviewed-on: https://code.wireshark.org/review/36390 Petri-Dish: Tomasz Moń <desowin@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Tomasz Moń <desowin@gmail.com>
2020-03-14USB HID: fix interpretation of unit exponent fieldFilipe Laíns1-1/+1
Change-Id: Id9752da61cca8a00e98049d7cf3f990e9199a684 Signed-off-by: Filipe Laíns <lains@archlinux.org> Reviewed-on: https://code.wireshark.org/review/36395 Petri-Dish: Tomasz Moń <desowin@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Tomasz Moń <desowin@gmail.com>
2020-03-14USB HID: dissect the missing fields from input/output/feature itemsFilipe Laíns1-2/+15
We try to provide as much useful information as we can in the top level item without it being too much. The approach on how to handle theese items was copied from hid-tools. Change-Id: I1c6b24c6fcd989b5188391cad8e7a629c58beebb Signed-off-by: Filipe Laíns <lains@archlinux.org> Reviewed-on: https://code.wireshark.org/review/36391 Petri-Dish: Tomasz Moń <desowin@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Tomasz Moń <desowin@gmail.com>
2020-03-14USB HID: provide item string for the unicode usage pageFilipe Laíns1-0/+3
Change-Id: Ib3db8854cc05c716ae4951b03caf452683c2e917 Signed-off-by: Filipe Laíns <lains@archlinux.org> Reviewed-on: https://code.wireshark.org/review/36393 Petri-Dish: Tomasz Moń <desowin@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Tomasz Moń <desowin@gmail.com>
2020-03-14USB HID: have a consistent styleFilipe Laíns1-434/+383
Change-Id: I2c2b89e6f7d2bce6af3043365d3f4c771044420b Signed-off-by: Filipe Laíns <lains@archlinux.org> Reviewed-on: https://code.wireshark.org/review/36392 Petri-Dish: Tomasz Moń <desowin@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Tomasz Moń <desowin@gmail.com>
2020-03-14USB HID: fix bug where logical min/max were being dissected as unsignedFilipe Laíns1-12/+13
Change-Id: Icf1b1b591ad76e2082b14344db19f1c0e8601455 Signed-off-by: Filipe Laíns <lains@archlinux.org> Reviewed-on: https://code.wireshark.org/review/36389 Petri-Dish: Tomasz Moń <desowin@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Tomasz Moń <desowin@gmail.com>
2020-03-13USB HID: make the dissection tree look as in the specFilipe Laíns1-25/+70
Currently, the top dissection tree looks like this: Global item (Usage Page) Local item (Usage) Main item (Collection) This approach is not great: it provides little relevant information. The item type (Main,Global,Local) is most of the time not relevant, it is used to differentiate items within the spec and is not useful to the end user. The item name (Usage Page, Usage, Collection, etc.) and its value is much more relevant to the end user. We show the name, which is great, but we don't show the value, forcing the user to open the subtree to access it. The report descriptors described in the spec are annotated like this: Usage Page (Generic Desktop) Usage (Mouse) Collection (Application) This patch makes the dissection tree look like that. All the information is still present in the tree but we put the information most people are actually interested in in the top level item. Change-Id: Idbfb0f137bc82b5e69787ee524585d18eb697340 Signed-off-by: Filipe Laíns <lains@archlinux.org> Reviewed-on: https://code.wireshark.org/review/36374 Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Tomasz Moń <desowin@gmail.com>
2020-03-11USB HID: use the correct names from the specFilipe Laíns1-18/+18
It's mostly identation but we also fix an incorrect spec name: Usage Pages. Usage Pages and Usages are different things, but the we currently call them both "Usages", which is wrong and confusing. Change-Id: I7e83fbe7dbd4c22a713ecbba136a2caf5d61e2fd Signed-off-by: Filipe Laíns <lains@archlinux.org> Reviewed-on: https://code.wireshark.org/review/36365 Petri-Dish: Tomasz Moń <desowin@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Tomasz Moń <desowin@gmail.com>
2020-03-11USB HID: refactor usage page identificationFilipe Laíns1-1978/+1978
The current approach to identify the the usage page and usage page usages is not great. It joins both the usage pages and the usages which are supposed to be individual values. The HID usage tables declarations also become harder to read as they hold the constructed value, not the value from the spec. This patch changes the HID usage table declartions from range_string to value_string, making them less bulky and easier to read, and splits out the usage page from the usages. Change-Id: I018406267fae43683d68c1349049e2c7c26f8ad6 Signed-off-by: Filipe Laíns <lains@archlinux.org> Reviewed-on: https://code.wireshark.org/review/36362 Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-07-26HTTPS (almost) everywhere.Guy Harris1-1/+1
Change all wireshark.org URLs to use https. Fix some broken links while we're at it. Change-Id: I161bf8eeca43b8027605acea666032da86f5ea1c Reviewed-on: https://code.wireshark.org/review/34089 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-08-24Fix Usb HID Report descriptor Local item Usage parsingAndrey1-4/+1941
Add usage values taken from "HID Usage Tables 1.12". Fix Global item Usage Page and Local item Usage concatenation. Change-Id: Ifeb09b60875460bd4bea0641dfa932479ffe6bbf Reviewed-on: https://code.wireshark.org/review/29253 Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>