drivers/media/rc/iguanair.c
Source file repositories/reference/linux-study-clean/drivers/media/rc/iguanair.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/rc/iguanair.c- Extension
.c- Size
- 13175 bytes
- Lines
- 569
- 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.
- 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/kernel.hlinux/module.hlinux/usb.hlinux/usb/input.hlinux/slab.hlinux/completion.hmedia/rc-core.h
Detected Declarations
struct iguanairstruct packetstruct send_packetfunction process_ir_datafunction iguanair_rxfunction iguanair_irq_outfunction iguanair_sendfunction iguanair_get_featuresfunction iguanair_receiverfunction iguanair_set_tx_carrierfunction iguanair_set_tx_maskfunction iguanair_txfunction iguanair_openfunction iguanair_closefunction iguanair_probefunction iguanair_disconnectfunction iguanair_suspendfunction iguanair_resume
Annotated Snippet
struct iguanair {
struct rc_dev *rc;
struct device *dev;
struct usb_device *udev;
uint16_t version;
uint8_t bufsize;
uint8_t cycle_overhead;
/* receiver support */
bool receiver_on;
dma_addr_t dma_in, dma_out;
uint8_t *buf_in;
struct urb *urb_in, *urb_out;
struct completion completion;
/* transmit support */
bool tx_overflow;
uint32_t carrier;
struct send_packet *packet;
char name[64];
char phys[64];
};
#define CMD_NOP 0x00
#define CMD_GET_VERSION 0x01
#define CMD_GET_BUFSIZE 0x11
#define CMD_GET_FEATURES 0x10
#define CMD_SEND 0x15
#define CMD_EXECUTE 0x1f
#define CMD_RX_OVERFLOW 0x31
#define CMD_TX_OVERFLOW 0x32
#define CMD_RECEIVER_ON 0x12
#define CMD_RECEIVER_OFF 0x14
#define DIR_IN 0xdc
#define DIR_OUT 0xcd
#define MAX_IN_PACKET 8u
#define MAX_OUT_PACKET (sizeof(struct send_packet) + BUF_SIZE)
#define TIMEOUT 1000
#define RX_RESOLUTION 21
struct packet {
uint16_t start;
uint8_t direction;
uint8_t cmd;
};
struct send_packet {
struct packet header;
uint8_t length;
uint8_t channels;
uint8_t busy7;
uint8_t busy4;
uint8_t payload[];
};
static void process_ir_data(struct iguanair *ir, unsigned len)
{
if (len >= 4 && ir->buf_in[0] == 0 && ir->buf_in[1] == 0) {
switch (ir->buf_in[3]) {
case CMD_GET_VERSION:
if (len == 6) {
ir->version = (ir->buf_in[5] << 8) |
ir->buf_in[4];
complete(&ir->completion);
}
break;
case CMD_GET_BUFSIZE:
if (len >= 5) {
ir->bufsize = ir->buf_in[4];
complete(&ir->completion);
}
break;
case CMD_GET_FEATURES:
if (len > 5) {
ir->cycle_overhead = ir->buf_in[5];
complete(&ir->completion);
}
break;
case CMD_TX_OVERFLOW:
ir->tx_overflow = true;
fallthrough;
case CMD_RECEIVER_OFF:
case CMD_RECEIVER_ON:
case CMD_SEND:
complete(&ir->completion);
Annotation
- Immediate include surface: `linux/device.h`, `linux/kernel.h`, `linux/module.h`, `linux/usb.h`, `linux/usb/input.h`, `linux/slab.h`, `linux/completion.h`, `media/rc-core.h`.
- Detected declarations: `struct iguanair`, `struct packet`, `struct send_packet`, `function process_ir_data`, `function iguanair_rx`, `function iguanair_irq_out`, `function iguanair_send`, `function iguanair_get_features`, `function iguanair_receiver`, `function iguanair_set_tx_carrier`.
- Atlas domain: Driver Families / drivers/media.
- 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.