drivers/media/usb/dvb-usb/dib0700_core.c
Source file repositories/reference/linux-study-clean/drivers/media/usb/dvb-usb/dib0700_core.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/usb/dvb-usb/dib0700_core.c- Extension
.c- Size
- 24220 bytes
- Lines
- 949
- 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
dib0700.h
Detected Declarations
struct dib0700_rc_responsefunction dib0700_get_versionfunction dib0700_ctrl_wrfunction dib0700_ctrl_rdfunction dib0700_set_gpiofunction dib0700_set_usb_xfer_lenfunction functionfunction functionfunction dib0700_i2c_xferfunction dib0700_i2c_funcfunction dib0700_identify_statefunction dib0700_set_clockfunction dib0700_set_i2c_speedfunction dib0700_ctrl_clockfunction dib0700_jumpramfunction dib0700_download_firmwarefunction dib0700_streaming_ctrlfunction dib0700_change_protocolfunction dib0700_rc_urb_completionfunction dib0700_rc_setupfunction dib0700_probefunction dib0700_disconnect
Annotated Snippet
struct dib0700_rc_response {
u8 report_id;
u8 data_state;
union {
struct {
u8 system;
u8 not_system;
u8 data;
u8 not_data;
} nec;
struct {
u8 not_used;
u8 system;
u8 data;
u8 not_data;
} rc5;
};
};
#define RC_MSG_SIZE_V1_20 6
static void dib0700_rc_urb_completion(struct urb *purb)
{
struct dvb_usb_device *d = purb->context;
struct dib0700_rc_response *poll_reply;
enum rc_proto protocol;
u32 keycode;
u8 toggle;
deb_info("%s()\n", __func__);
if (d->rc_dev == NULL) {
/* This will occur if disable_rc_polling=1 */
kfree(purb->transfer_buffer);
usb_free_urb(purb);
return;
}
poll_reply = purb->transfer_buffer;
if (purb->status < 0) {
deb_info("discontinuing polling\n");
kfree(purb->transfer_buffer);
usb_free_urb(purb);
return;
}
if (purb->actual_length != RC_MSG_SIZE_V1_20) {
deb_info("malformed rc msg size=%d\n", purb->actual_length);
goto resubmit;
}
deb_data("IR ID = %02X state = %02X System = %02X %02X Cmd = %02X %02X (len %d)\n",
poll_reply->report_id, poll_reply->data_state,
poll_reply->nec.system, poll_reply->nec.not_system,
poll_reply->nec.data, poll_reply->nec.not_data,
purb->actual_length);
switch (d->props.rc.core.protocol) {
case RC_PROTO_BIT_NEC:
toggle = 0;
/* NEC protocol sends repeat code as 0 0 0 FF */
if (poll_reply->nec.system == 0x00 &&
poll_reply->nec.not_system == 0x00 &&
poll_reply->nec.data == 0x00 &&
poll_reply->nec.not_data == 0xff) {
poll_reply->data_state = 2;
rc_repeat(d->rc_dev);
goto resubmit;
}
if ((poll_reply->nec.data ^ poll_reply->nec.not_data) != 0xff) {
deb_data("NEC32 protocol\n");
keycode = RC_SCANCODE_NEC32(poll_reply->nec.system << 24 |
poll_reply->nec.not_system << 16 |
poll_reply->nec.data << 8 |
poll_reply->nec.not_data);
protocol = RC_PROTO_NEC32;
} else if ((poll_reply->nec.system ^ poll_reply->nec.not_system) != 0xff) {
deb_data("NEC extended protocol\n");
keycode = RC_SCANCODE_NECX(poll_reply->nec.system << 8 |
poll_reply->nec.not_system,
poll_reply->nec.data);
protocol = RC_PROTO_NECX;
} else {
deb_data("NEC normal protocol\n");
keycode = RC_SCANCODE_NEC(poll_reply->nec.system,
poll_reply->nec.data);
protocol = RC_PROTO_NEC;
}
Annotation
- Immediate include surface: `dib0700.h`.
- Detected declarations: `struct dib0700_rc_response`, `function dib0700_get_version`, `function dib0700_ctrl_wr`, `function dib0700_ctrl_rd`, `function dib0700_set_gpio`, `function dib0700_set_usb_xfer_len`, `function function`, `function function`, `function dib0700_i2c_xfer`, `function dib0700_i2c_func`.
- 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.