drivers/accessibility/braille/braille_console.c
Source file repositories/reference/linux-study-clean/drivers/accessibility/braille/braille_console.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/accessibility/braille/braille_console.c- Extension
.c- Size
- 7468 bytes
- Lines
- 380
- Domain
- Driver Families
- Bucket
- drivers/accessibility
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kernel.hlinux/module.hlinux/moduleparam.hlinux/console.hlinux/notifier.hlinux/selection.hlinux/vt_kern.hlinux/consolemap.hlinux/keyboard.hlinux/kbd_kern.hlinux/input.h
Detected Declarations
function beepfunction braille_writefunction vc_follow_cursorfunction vc_maybe_cursor_movedfunction vc_refreshfunction keyboard_notifier_callfunction vt_notifier_callfunction braille_register_consolefunction braille_unregister_console
Annotated Snippet
if (out <= 0x05) {
*c++ = SOH;
out |= 0x40;
}
*c++ = out;
}
if (csum <= 0x05) {
*c++ = SOH;
csum |= 0x40;
}
*c++ = csum;
*c++ = ETX;
braille_co->write(braille_co, data, c - data);
}
/* Follow the VC cursor*/
static void vc_follow_cursor(struct vc_data *vc)
{
vc_x = vc->state.x - (vc->state.x % WIDTH);
vc_y = vc->state.y;
lastvc_x = vc->state.x;
lastvc_y = vc->state.y;
}
/* Maybe the VC cursor moved, if so follow it */
static void vc_maybe_cursor_moved(struct vc_data *vc)
{
if (vc->state.x != lastvc_x || vc->state.y != lastvc_y)
vc_follow_cursor(vc);
}
/* Show portion of VC at vc_x, vc_y */
static void vc_refresh(struct vc_data *vc)
{
u16 buf[WIDTH];
int i;
for (i = 0; i < WIDTH; i++) {
u16 glyph = screen_glyph(vc,
2 * (vc_x + i) + vc_y * vc->vc_size_row);
buf[i] = inverse_translate(vc, glyph, true);
}
braille_write(buf);
}
/*
* Link to keyboard
*/
static int keyboard_notifier_call(struct notifier_block *blk,
unsigned long code, void *_param)
{
struct keyboard_notifier_param *param = _param;
struct vc_data *vc = param->vc;
int ret = NOTIFY_OK;
if (!param->down)
return ret;
switch (code) {
case KBD_KEYCODE:
if (console_show) {
if (param->value == BRAILLE_KEY) {
console_show = 0;
beep(880);
vc_maybe_cursor_moved(vc);
vc_refresh(vc);
ret = NOTIFY_STOP;
}
} else {
ret = NOTIFY_STOP;
switch (param->value) {
case KEY_INSERT:
beep(440);
console_show = 1;
lastVC = -1;
braille_write(console_buf);
break;
case KEY_LEFT:
if (vc_x > 0) {
vc_x -= WIDTH;
if (vc_x < 0)
vc_x = 0;
} else if (vc_y >= 1) {
beep(880);
vc_y--;
vc_x = vc->vc_cols-WIDTH;
} else
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/module.h`, `linux/moduleparam.h`, `linux/console.h`, `linux/notifier.h`, `linux/selection.h`, `linux/vt_kern.h`, `linux/consolemap.h`.
- Detected declarations: `function beep`, `function braille_write`, `function vc_follow_cursor`, `function vc_maybe_cursor_moved`, `function vc_refresh`, `function keyboard_notifier_call`, `function vt_notifier_call`, `function braille_register_console`, `function braille_unregister_console`.
- Atlas domain: Driver Families / drivers/accessibility.
- 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.