drivers/media/rc/redrat3.c
Source file repositories/reference/linux-study-clean/drivers/media/rc/redrat3.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/rc/redrat3.c- Extension
.c- Size
- 31689 bytes
- Lines
- 1183
- 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/unaligned.hlinux/device.hlinux/leds.hlinux/module.hlinux/slab.hlinux/usb.hlinux/usb/input.hmedia/rc-core.h
Detected Declarations
struct redrat3_headerstruct redrat3_irdatastruct redrat3_errorstruct redrat3_devfunction redrat3_dump_fw_errorfunction redrat3_val_to_mod_freqfunction redrat3_len_to_usfunction redrat3_us_to_lenfunction redrat3_process_ir_datafunction redrat3_send_cmdfunction redrat3_enable_detectorfunction redrat3_deletefunction redrat3_get_timeoutfunction redrat3_set_timeoutfunction redrat3_resetfunction redrat3_get_firmware_revfunction redrat3_read_packet_startfunction redrat3_read_packet_continuefunction redrat3_get_ir_datafunction redrat3_handle_asyncfunction mod_freq_to_valfunction redrat3_set_tx_carrierfunction redrat3_transmit_irfunction redrat3_brightness_setfunction redrat3_wideband_receiverfunction redrat3_learn_completefunction redrat3_led_completefunction redrat3_dev_probefunction redrat3_dev_disconnectfunction redrat3_dev_suspendfunction redrat3_dev_resume
Annotated Snippet
struct redrat3_header {
__be16 length;
__be16 transfer_type;
} __packed;
/* sending and receiving irdata */
struct redrat3_irdata {
struct redrat3_header header;
__be32 pause;
__be16 mod_freq_count;
__be16 num_periods;
__u8 max_lengths;
__u8 no_lengths;
__be16 max_sig_size;
__be16 sig_size;
__u8 no_repeats;
__be16 lens[RR3_DRIVER_MAXLENS]; /* not aligned */
__u8 sigdata[RR3_MAX_SIG_SIZE];
} __packed;
/* firmware errors */
struct redrat3_error {
struct redrat3_header header;
__be16 fw_error;
} __packed;
/* table of devices that work with this driver */
static const struct usb_device_id redrat3_dev_table[] = {
/* Original version of the RedRat3 */
{USB_DEVICE(USB_RR3USB_VENDOR_ID, USB_RR3USB_PRODUCT_ID)},
/* Second Version/release of the RedRat3 - RetRat3-II */
{USB_DEVICE(USB_RR3USB_VENDOR_ID, USB_RR3IIUSB_PRODUCT_ID)},
{} /* Terminating entry */
};
/* Structure to hold all of our device specific stuff */
struct redrat3_dev {
/* core device bits */
struct rc_dev *rc;
struct device *dev;
/* led control */
struct led_classdev led;
atomic_t flash;
struct usb_ctrlrequest flash_control;
struct urb *flash_urb;
u8 flash_in_buf;
/* learning */
bool wideband;
struct usb_ctrlrequest learn_control;
struct urb *learn_urb;
u8 learn_buf;
/* save off the usb device pointer */
struct usb_device *udev;
/* the receive endpoint */
struct usb_endpoint_descriptor *ep_narrow;
/* the buffer to receive data */
void *bulk_in_buf;
/* urb used to read ir data */
struct urb *narrow_urb;
struct urb *wide_urb;
/* the send endpoint */
struct usb_endpoint_descriptor *ep_out;
/* usb dma */
dma_addr_t dma_in;
/* Is the device currently transmitting?*/
bool transmitting;
/* store for current packet */
struct redrat3_irdata irdata;
u16 bytes_read;
u32 carrier;
char name[64];
char phys[64];
};
static void redrat3_dump_fw_error(struct redrat3_dev *rr3, int code)
{
if (!rr3->transmitting && (code != 0x40))
dev_info(rr3->dev, "fw error code 0x%02x: ", code);
switch (code) {
Annotation
- Immediate include surface: `linux/unaligned.h`, `linux/device.h`, `linux/leds.h`, `linux/module.h`, `linux/slab.h`, `linux/usb.h`, `linux/usb/input.h`, `media/rc-core.h`.
- Detected declarations: `struct redrat3_header`, `struct redrat3_irdata`, `struct redrat3_error`, `struct redrat3_dev`, `function redrat3_dump_fw_error`, `function redrat3_val_to_mod_freq`, `function redrat3_len_to_us`, `function redrat3_us_to_len`, `function redrat3_process_ir_data`, `function redrat3_send_cmd`.
- 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.