drivers/accessibility/speakup/main.c
Source file repositories/reference/linux-study-clean/drivers/accessibility/speakup/main.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/accessibility/speakup/main.c- Extension
.c- Size
- 63600 bytes
- Lines
- 2500
- Domain
- Driver Families
- Bucket
- drivers/accessibility
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- 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/vt.hlinux/tty.hlinux/mm.hlinux/vt_kern.hlinux/ctype.hlinux/selection.hlinux/unistd.hlinux/jiffies.hlinux/kthread.hlinux/keyboard.hlinux/kbd_kern.hlinux/input.hlinux/kmod.hlinux/module.hlinux/sched.hlinux/slab.hlinux/types.hlinux/consolemap.hlinux/spinlock.hlinux/notifier.hlinux/uaccess.hspk_priv.hspeakup.hspeakupmap.h
Detected Declarations
enum cursor_trackenum edgeenum spk_vars_idenum read_all_commandfunction get_attributesfunction speakup_datefunction bleepfunction speakup_shut_upfunction speech_killfunction speakup_offfunction speakup_parkedfunction speakup_cutfunction speakup_pastefunction say_attributesfunction announce_edgefunction speak_charfunction get_charfunction say_charfunction say_phonetic_charfunction say_prev_charfunction say_next_charfunction get_wordfunction get_charfunction say_wordfunction say_prev_wordfunction say_next_wordfunction spell_wordfunction get_linefunction say_linefunction say_prev_linefunction say_next_linefunction say_from_tofunction say_line_from_tofunction say_sentence_numfunction get_sentence_buffunction say_screen_from_tofunction say_screenfunction speakup_win_sayfunction top_edgefunction bottom_edgefunction left_edgefunction right_edgefunction say_first_charfunction say_last_charfunction say_positionfunction say_char_numfunction say_from_topfunction say_to_bottom
Annotated Snippet
/* call by: module_init() */
static int __init speakup_init(void)
{
int i;
long err = 0;
struct vc_data *vc = vc_cons[fg_console].d;
struct var_t *var;
/* These first few initializations cannot fail. */
spk_initialize_msgs(); /* Initialize arrays for i18n. */
spk_reset_default_chars();
spk_reset_default_chartab();
spk_strlwr(synth_name);
spk_vars[0].u.n.high = vc->vc_cols;
for (var = spk_vars; var->var_id != MAXVARS; var++)
speakup_register_var(var);
for (var = synth_time_vars;
(var->var_id >= 0) && (var->var_id < MAXVARS); var++)
speakup_register_var(var);
for (i = 1; spk_punc_info[i].mask != 0; i++)
spk_set_mask_bits(NULL, i, 2);
spk_set_key_info(spk_key_defaults, spk_key_buf);
/* From here on out, initializations can fail. */
err = speakup_add_virtual_keyboard();
if (err)
goto error_virtkeyboard;
for (i = 0; i < MAX_NR_CONSOLES; i++)
if (vc_cons[i].d) {
err = speakup_allocate(vc_cons[i].d, GFP_KERNEL);
if (err)
goto error_kobjects;
}
if (spk_quiet_boot)
spk_shut_up |= 0x01;
err = speakup_kobj_init();
if (err)
goto error_kobjects;
spk_ttyio_register_ldisc();
synth_init(synth_name);
speakup_register_devsynth();
/*
* register_devsynth might fail, but this error is not fatal.
* /dev/synth is an extra feature; the rest of Speakup
* will work fine without it.
*/
err = register_keyboard_notifier(&keyboard_notifier_block);
if (err)
goto error_kbdnotifier;
err = register_vt_notifier(&vt_notifier_block);
if (err)
goto error_vtnotifier;
speakup_task = kthread_create(speakup_thread, NULL, "speakup");
if (IS_ERR(speakup_task)) {
err = PTR_ERR(speakup_task);
goto error_task;
}
set_user_nice(speakup_task, 10);
wake_up_process(speakup_task);
pr_info("speakup %s: initialized\n", SPEAKUP_VERSION);
pr_info("synth name on entry is: %s\n", synth_name);
goto out;
error_task:
unregister_vt_notifier(&vt_notifier_block);
error_vtnotifier:
unregister_keyboard_notifier(&keyboard_notifier_block);
timer_delete(&cursor_timer);
error_kbdnotifier:
speakup_unregister_devsynth();
mutex_lock(&spk_mutex);
synth_release();
mutex_unlock(&spk_mutex);
speakup_kobj_exit();
error_kobjects:
for (i = 0; i < MAX_NR_CONSOLES; i++)
kfree(speakup_console[i]);
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/vt.h`, `linux/tty.h`, `linux/mm.h`, `linux/vt_kern.h`, `linux/ctype.h`, `linux/selection.h`, `linux/unistd.h`.
- Detected declarations: `enum cursor_track`, `enum edge`, `enum spk_vars_id`, `enum read_all_command`, `function get_attributes`, `function speakup_date`, `function bleep`, `function speakup_shut_up`, `function speech_kill`, `function speakup_off`.
- Atlas domain: Driver Families / drivers/accessibility.
- Implementation status: integration 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.