drivers/hid/wacom_sys.c
Source file repositories/reference/linux-study-clean/drivers/hid/wacom_sys.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/hid/wacom_sys.c- Extension
.c- Size
- 77603 bytes
- Lines
- 2965
- Domain
- Driver Families
- Bucket
- drivers/hid
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
wacom_wac.hwacom.hlinux/input/mt.h
Detected Declarations
struct wacom_hdev_datastruct wacom_sysfs_group_devresfunction wacom_get_reportfunction wacom_set_reportfunction wacom_wac_queue_insertfunction wacom_wac_queue_flushfunction wacom_wac_pen_serial_enforcefunction wacom_raw_eventfunction wacom_openfunction wacom_closefunction wacom_calc_hid_resfunction wacom_hid_usage_quirkfunction WACOM_PEN_FIELDfunction wacom_feature_mappingfunction wacom_usage_mappingfunction wacom_post_parse_hidfunction wacom_parse_hidfunction wacom_hid_set_device_modefunction wacom_set_device_modefunction wacom_bt_query_tablet_datafunction _wacom_query_tablet_datafunction wacom_retrieve_hid_descriptorfunction tabletsfunction wacom_are_siblingfunction wacom_release_shared_datafunction wacom_remove_shared_datafunction wacom_add_shared_datafunction wacom_led_controlfunction wacom_led_putimagefunction wacom_led_select_storefunction wacom_luminance_storefunction wacom_button_image_storefunction wacom_devm_sysfs_group_releasefunction __wacom_devm_sysfs_create_groupfunction wacom_devm_sysfs_create_groupfunction wacom_devm_kfifo_releasefunction wacom_devm_kfifo_allocfunction wacom_leds_brightness_getfunction __wacom_led_brightness_getfunction wacom_led_brightness_setfunction wacom_led_readonly_brightness_setfunction wacom_led_groups_release_onefunction wacom_led_groups_alloc_and_register_onefunction wacom_led_groups_releasefunction wacom_led_groups_allocatefunction wacom_leds_alloc_and_registerfunction wacom_initialize_ledsfunction wacom_init_work
Annotated Snippet
struct wacom_hdev_data {
struct list_head list;
struct kref kref;
struct hid_device *dev;
struct wacom_shared shared;
};
static LIST_HEAD(wacom_udev_list);
static DEFINE_MUTEX(wacom_udev_list_lock);
static bool wacom_are_sibling(struct hid_device *hdev,
struct hid_device *sibling)
{
struct wacom *wacom = hid_get_drvdata(hdev);
struct wacom_features *features = &wacom->wacom_wac.features;
struct wacom *sibling_wacom = hid_get_drvdata(sibling);
struct wacom_features *sibling_features = &sibling_wacom->wacom_wac.features;
__u32 oVid = features->oVid ? features->oVid : hdev->vendor;
__u32 oPid = features->oPid ? features->oPid : hdev->product;
/* The defined oVid/oPid must match that of the sibling */
if (features->oVid != HID_ANY_ID && sibling->vendor != oVid)
return false;
if (features->oPid != HID_ANY_ID && sibling->product != oPid)
return false;
/*
* Devices with the same VID/PID must share the same physical
* device path, while those with different VID/PID must share
* the same physical parent device path.
*/
if (hdev->vendor == sibling->vendor && hdev->product == sibling->product) {
if (!hid_compare_device_paths(hdev, sibling, '/'))
return false;
} else {
if (!hid_compare_device_paths(hdev, sibling, '.'))
return false;
}
/* Skip the remaining heuristics unless you are a HID_GENERIC device */
if (features->type != HID_GENERIC)
return true;
/*
* Direct-input devices may not be siblings of indirect-input
* devices.
*/
if ((features->device_type & WACOM_DEVICETYPE_DIRECT) &&
!(sibling_features->device_type & WACOM_DEVICETYPE_DIRECT))
return false;
/*
* Indirect-input devices may not be siblings of direct-input
* devices.
*/
if (!(features->device_type & WACOM_DEVICETYPE_DIRECT) &&
(sibling_features->device_type & WACOM_DEVICETYPE_DIRECT))
return false;
/* Pen devices may only be siblings of touch devices */
if ((features->device_type & WACOM_DEVICETYPE_PEN) &&
!(sibling_features->device_type & WACOM_DEVICETYPE_TOUCH))
return false;
/* Touch devices may only be siblings of pen devices */
if ((features->device_type & WACOM_DEVICETYPE_TOUCH) &&
!(sibling_features->device_type & WACOM_DEVICETYPE_PEN))
return false;
/*
* No reason could be found for these two devices to NOT be
* siblings, so there's a good chance they ARE siblings
*/
return true;
}
static struct wacom_hdev_data *wacom_get_hdev_data(struct hid_device *hdev)
{
struct wacom_hdev_data *data;
/* Try to find an already-probed interface from the same device */
list_for_each_entry(data, &wacom_udev_list, list) {
if (hid_compare_device_paths(hdev, data->dev, '/')) {
kref_get(&data->kref);
return data;
}
}
/* Fallback to finding devices that appear to be "siblings" */
list_for_each_entry(data, &wacom_udev_list, list) {
Annotation
- Immediate include surface: `wacom_wac.h`, `wacom.h`, `linux/input/mt.h`.
- Detected declarations: `struct wacom_hdev_data`, `struct wacom_sysfs_group_devres`, `function wacom_get_report`, `function wacom_set_report`, `function wacom_wac_queue_insert`, `function wacom_wac_queue_flush`, `function wacom_wac_pen_serial_enforce`, `function wacom_raw_event`, `function wacom_open`, `function wacom_close`.
- Atlas domain: Driver Families / drivers/hid.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.