Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tools: add a debug-device utility #666

Merged
merged 1 commit into from
Apr 28, 2024
Merged

Conversation

whot
Copy link
Member

@whot whot commented Apr 23, 2024

This one simply prints all return values for a device from our API, making it easier to figure out the exact behavior of a device. This is a debug utility so it is not installed.

Example output:
libwacom_get_name() -> "Wacom Cintiq 24HD touch"
libwacom_get_model_name() -> "DTH-2400"
libwacom_get_layout_filename() -> "data/layouts/cintiq-24hd.svg"
libwacom_get_vendor_id() -> 0x56a
libwacom_get_product_id() -> 0xf8
libwacom_get_bustype() -> USB
libwacom_get_width() -> 21
libwacom_get_height() -> 13
libwacom_is_reversible() -> 0


cc @JoseExposito

Copy link
Contributor

@JoseExposito JoseExposito left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a few minor comments, looking really good. For reference, this is the output for my Hioun tablet:

libwacom_get_name()                      -> "Huion H640P"
libwacom_get_model_name()                -> "(null)"
libwacom_get_layout_filename()           -> "/home/jexposit/Devel/libwacom/data/layouts/huion-h640p.svg"
libwacom_get_vendor_id()                 -> 0x256c
libwacom_get_product_id()                -> 0x006d
libwacom_get_bustype()                   -> USB
libwacom_get_width()                     -> 6
libwacom_get_height()                    -> 4
libwacom_is_reversible()                 -> 1
libwacom_get_matches() -> {
  {
    libwacom_match_get_match_string()        -> "usb|256c|006d|HUION Huion Tablet_H640P Pad"
    libwacom_match_get_name()                -> "HUION Huion Tablet_H640P Pad"
    libwacom_match_get_uniq()                -> "(null)"
    libwacom_match_get_bustype()             -> 0x0001
    libwacom_match_get_vendor_id()           -> 0x256c
    libwacom_match_get_product_id()          -> 0x006d
  }
  {
    libwacom_match_get_match_string()        -> "usb|256c|006d|HUION Huion Tablet_H640P Pen"
    libwacom_match_get_name()                -> "HUION Huion Tablet_H640P Pen"
    libwacom_match_get_uniq()                -> "(null)"
    libwacom_match_get_bustype()             -> 0x0001
    libwacom_match_get_vendor_id()           -> 0x256c
    libwacom_match_get_product_id()          -> 0x006d
  }
}
libwacom_get_match()                     -> "usb|256c|006d|HUION Huion Tablet_H640P Pad"
libwacom_get_paired_device() -> {<none>
}
libwacom_has_stylus()                    -> 1
libwacom_has_touch()                     -> 0
libwacom_get_num_buttons()               -> 6
libwacom_get_num_keys()                  -> 0
libwacom_has_ring()                      -> 0
libwacom_has_ring2()                     -> 0
libwacom_has_touchswitch()               -> 0
libwacom_get_ring_num_modes()            -> 0
libwacom_get_ring2_num_modes()           -> 0
libwacom_get_num_strips()                -> 0
libwacom_get_strips_num_modes()          -> 0
libwacom_get_integration_flags()         -> NONE 
libwacom_get_button_led_group('A')       -> -1
libwacom_get_button_led_group('B')       -> -1
libwacom_get_button_led_group('C')       -> -1
libwacom_get_button_led_group('D')       -> -1
libwacom_get_button_led_group('E')       -> -1
libwacom_get_button_led_group('F')       -> -1
libwacom_get_button_evdev_code('A')      -> 0x100
libwacom_get_button_evdev_code('B')      -> 0x101
libwacom_get_button_evdev_code('C')      -> 0x102
libwacom_get_button_evdev_code('D')      -> 0x103
libwacom_get_button_evdev_code('E')      -> 0x104
libwacom_get_button_evdev_code('F')      -> 0x105
libwacom_get_button_flag('A')            -> POSITION_LEFT|
libwacom_get_button_flag('B')            -> POSITION_LEFT|
libwacom_get_button_flag('C')            -> POSITION_LEFT|
libwacom_get_button_flag('D')            -> POSITION_LEFT|
libwacom_get_button_flag('E')            -> POSITION_LEFT|
libwacom_get_button_flag('F')            -> POSITION_LEFT|
libwacom_get_status_leds()               -> []
libwacom_get_supported_styli()           -> [0x0ffffd]

tools/debug-device.c Outdated Show resolved Hide resolved
tools/debug-device.c Show resolved Hide resolved
tools/debug-device.c Outdated Show resolved Hide resolved
tools/debug-device.c Outdated Show resolved Hide resolved
This one simply prints all return values for a device from our API,
making it easier to figure out the exact behavior of a device.
This is a debug utility so it is not installed.

Example output:
  libwacom_get_name()                      -> "Wacom Cintiq 24HD touch"
  libwacom_get_model_name()                -> "DTH-2400"
  libwacom_get_layout_filename()           -> "data/layouts/cintiq-24hd.svg"
  libwacom_get_vendor_id()                 -> 0x56a
  libwacom_get_product_id()                -> 0xf8
  libwacom_get_bustype()                   -> USB
  libwacom_get_width()                     -> 21
  libwacom_get_height()                    -> 13
  libwacom_is_reversible()                 -> 0
@whot whot force-pushed the wip/debug-device branch from ab6e51a to 1f77315 Compare April 23, 2024 23:39
@whot
Copy link
Member Author

whot commented Apr 23, 2024

Thanks, all review comments addressed and I added the --with-styli ability to print the same info about the compatible styli - which will also come in handy for debugging one day.

Plus a small change in the printing to align the output better.

Copy link
Contributor

@JoseExposito JoseExposito left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the quick fixes, LGTM

@whot whot merged commit c7402c7 into linuxwacom:master Apr 28, 2024
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants