drivers/media/rc/ati_remote.c
Source file repositories/reference/linux-study-clean/drivers/media/rc/ati_remote.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/rc/ati_remote.c- Extension
.c- Size
- 28447 bytes
- Lines
- 972
- Domain
- Driver Families
- Bucket
- drivers/media
- 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
linux/kernel.hlinux/errno.hlinux/init.hlinux/slab.hlinux/module.hlinux/mutex.hlinux/usb/input.hlinux/wait.hlinux/jiffies.hmedia/rc-core.h
Detected Declarations
struct ati_receiver_typestruct ati_remotestruct accel_timesfunction ati_remote_dumpfunction ati_remote_openfunction ati_remote_closefunction ati_remote_input_openfunction ati_remote_input_closefunction ati_remote_rc_openfunction ati_remote_rc_closefunction ati_remote_irq_outfunction ati_remote_sendpacketfunction ati_remote_compute_accelfunction ati_remote_input_reportfunction ati_remote_irq_infunction ati_remote_alloc_buffersfunction ati_remote_free_buffersfunction ati_remote_input_initfunction ati_remote_rc_initfunction ati_remote_initializefunction ati_remote_probefunction ati_remote_disconnect
Annotated Snippet
struct ati_receiver_type {
/* either default_keymap or get_default_keymap should be set */
const char *default_keymap;
const char *(*get_default_keymap)(struct usb_interface *interface);
};
static const char *get_medion_keymap(struct usb_interface *interface)
{
struct usb_device *udev = interface_to_usbdev(interface);
/*
* There are many different Medion remotes shipped with a receiver
* with the same usb id, but the receivers have subtle differences
* in the USB descriptors allowing us to detect them.
*/
if (udev->manufacturer && udev->product) {
if (udev->actconfig->desc.bmAttributes & USB_CONFIG_ATT_WAKEUP) {
if (!strcmp(udev->manufacturer, "X10 Wireless Technology Inc")
&& !strcmp(udev->product, "USB Receiver"))
return RC_MAP_MEDION_X10_DIGITAINER;
if (!strcmp(udev->manufacturer, "X10 WTI")
&& !strcmp(udev->product, "RF receiver"))
return RC_MAP_MEDION_X10_OR2X;
} else {
if (!strcmp(udev->manufacturer, "X10 Wireless Technology Inc")
&& !strcmp(udev->product, "USB Receiver"))
return RC_MAP_MEDION_X10;
}
}
dev_info(&interface->dev,
"Unknown Medion X10 receiver, using default ati_remote Medion keymap\n");
return RC_MAP_MEDION_X10;
}
static const struct ati_receiver_type type_ati = {
.default_keymap = RC_MAP_ATI_X10
};
static const struct ati_receiver_type type_medion = {
.get_default_keymap = get_medion_keymap
};
static const struct ati_receiver_type type_firefly = {
.default_keymap = RC_MAP_SNAPSTREAM_FIREFLY
};
static const struct usb_device_id ati_remote_table[] = {
{
USB_DEVICE(ATI_REMOTE_VENDOR_ID, LOLA_REMOTE_PRODUCT_ID),
.driver_info = (unsigned long)&type_ati
},
{
USB_DEVICE(ATI_REMOTE_VENDOR_ID, LOLA2_REMOTE_PRODUCT_ID),
.driver_info = (unsigned long)&type_ati
},
{
USB_DEVICE(ATI_REMOTE_VENDOR_ID, ATI_REMOTE_PRODUCT_ID),
.driver_info = (unsigned long)&type_ati
},
{
USB_DEVICE(ATI_REMOTE_VENDOR_ID, NVIDIA_REMOTE_PRODUCT_ID),
.driver_info = (unsigned long)&type_ati
},
{
USB_DEVICE(ATI_REMOTE_VENDOR_ID, MEDION_REMOTE_PRODUCT_ID),
.driver_info = (unsigned long)&type_medion
},
{
USB_DEVICE(ATI_REMOTE_VENDOR_ID, FIREFLY_REMOTE_PRODUCT_ID),
.driver_info = (unsigned long)&type_firefly
},
{} /* Terminating entry */
};
MODULE_DEVICE_TABLE(usb, ati_remote_table);
/* Get hi and low bytes of a 16-bits int */
#define HI(a) ((unsigned char)((a) >> 8))
#define LO(a) ((unsigned char)((a) & 0xff))
#define SEND_FLAG_IN_PROGRESS 1
#define SEND_FLAG_COMPLETE 2
/* Device initialization strings */
static char init1[] = { 0x01, 0x00, 0x20, 0x14 };
static char init2[] = { 0x01, 0x00, 0x20, 0x14, 0x20, 0x20, 0x20 };
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/errno.h`, `linux/init.h`, `linux/slab.h`, `linux/module.h`, `linux/mutex.h`, `linux/usb/input.h`, `linux/wait.h`.
- Detected declarations: `struct ati_receiver_type`, `struct ati_remote`, `struct accel_times`, `function ati_remote_dump`, `function ati_remote_open`, `function ati_remote_close`, `function ati_remote_input_open`, `function ati_remote_input_close`, `function ati_remote_rc_open`, `function ati_remote_rc_close`.
- Atlas domain: Driver Families / drivers/media.
- 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.