drivers/hid/hid-letsketch.c
Source file repositories/reference/linux-study-clean/drivers/hid/hid-letsketch.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/hid/hid-letsketch.c- Extension
.c- Size
- 9466 bytes
- Lines
- 325
- 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.
- 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
linux/device.hlinux/input.hlinux/hid.hlinux/module.hlinux/timer.hlinux/usb.hlinux/unaligned.hhid-ids.h
Detected Declarations
struct letsketch_datafunction letsketch_openfunction letsketch_closefunction letsketch_setup_input_tabletfunction letsketch_setup_input_tablet_padfunction letsketch_inrange_timeoutfunction letsketch_raw_eventfunction letsketch_get_stringfunction letsketch_probe
Annotated Snippet
struct letsketch_data {
struct hid_device *hdev;
struct input_dev *input_tablet;
struct input_dev *input_tablet_pad;
struct timer_list inrange_timer;
};
static int letsketch_open(struct input_dev *dev)
{
struct letsketch_data *data = input_get_drvdata(dev);
return hid_hw_open(data->hdev);
}
static void letsketch_close(struct input_dev *dev)
{
struct letsketch_data *data = input_get_drvdata(dev);
hid_hw_close(data->hdev);
}
static struct input_dev *letsketch_alloc_input_dev(struct letsketch_data *data)
{
struct input_dev *input;
input = devm_input_allocate_device(&data->hdev->dev);
if (!input)
return NULL;
input->id.bustype = data->hdev->bus;
input->id.vendor = data->hdev->vendor;
input->id.product = data->hdev->product;
input->id.version = data->hdev->bus;
input->phys = data->hdev->phys;
input->uniq = data->hdev->uniq;
input->open = letsketch_open;
input->close = letsketch_close;
input_set_drvdata(input, data);
return input;
}
static int letsketch_setup_input_tablet(struct letsketch_data *data)
{
struct input_dev *input;
input = letsketch_alloc_input_dev(data);
if (!input)
return -ENOMEM;
input_set_abs_params(input, ABS_X, 0, 50800, 0, 0);
input_set_abs_params(input, ABS_Y, 0, 31750, 0, 0);
input_set_abs_params(input, ABS_PRESSURE, 0, 8192, 0, 0);
input_abs_set_res(input, ABS_X, 240);
input_abs_set_res(input, ABS_Y, 225);
input_set_capability(input, EV_KEY, BTN_TOUCH);
input_set_capability(input, EV_KEY, BTN_TOOL_PEN);
input_set_capability(input, EV_KEY, BTN_STYLUS);
input_set_capability(input, EV_KEY, BTN_STYLUS2);
/* All known brands selling this tablet use WP9620[N] as model name */
input->name = "WP9620 Tablet";
data->input_tablet = input;
return input_register_device(data->input_tablet);
}
static int letsketch_setup_input_tablet_pad(struct letsketch_data *data)
{
struct input_dev *input;
int i;
input = letsketch_alloc_input_dev(data);
if (!input)
return -ENOMEM;
for (i = 0; i < LETSKETCH_PAD_BUTTONS; i++)
input_set_capability(input, EV_KEY, BTN_0 + i);
/*
* These are never send on the pad input_dev, but must be set
* on the Pad to make udev / libwacom happy.
*/
input_set_abs_params(input, ABS_X, 0, 1, 0, 0);
input_set_abs_params(input, ABS_Y, 0, 1, 0, 0);
input_set_capability(input, EV_KEY, BTN_STYLUS);
input->name = "WP9620 Pad";
Annotation
- Immediate include surface: `linux/device.h`, `linux/input.h`, `linux/hid.h`, `linux/module.h`, `linux/timer.h`, `linux/usb.h`, `linux/unaligned.h`, `hid-ids.h`.
- Detected declarations: `struct letsketch_data`, `function letsketch_open`, `function letsketch_close`, `function letsketch_setup_input_tablet`, `function letsketch_setup_input_tablet_pad`, `function letsketch_inrange_timeout`, `function letsketch_raw_event`, `function letsketch_get_string`, `function letsketch_probe`.
- Atlas domain: Driver Families / drivers/hid.
- Implementation status: source implementation candidate.
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.