comedi_auto_config(9)
π comedi_auto_config(9)
okay so this is a page straight out of the Kernel API Manual, and it's literally the glow-up moment where a hardware device becomes a COMEDI device. bestie, it's giving matchmaker energy π
β¨ NAME β¨
comedi_auto_config β Create a COMEDI device for a hardware device
π¦ SYNOPSIS π¦
int comedi_auto_config (struct device *hardware_device , struct
comedi_driver *driver , unsigned long context );
πΈ ARGUMENTS πΈ
hardware_deviceβ the hardware device. yes, that one. the actual physical-ish thing you're setting up π«Άdriverβ the COMEDI low-level driver for the hardware device. this is the one doing the actual work, no cap.contextβ driver context for theauto_attachhandler. think of it as the little note you pass along soauto_attachknows what's up π
π DESCRIPTION π
So what happens is: it allocates a new COMEDI device for the hardware device, then calls the low-level driver's auto_attach handler to set up the hardware and allocate the COMEDI subdevices. iconic behaviour, honestly β¨
Then, once auto_attach returns successfully, some extra "post-configuration" setting up gets performed. but listen β if the auto_attach handler fails, the low-level driver's detach handler gets called as part of the clean-up. so it always tidies up after itself, we love a responsible main character π§Ή
This is usually called from a wrapper function in a bus-specific COMEDI module, which in turn is usually called from a bus device probe function in the low-level driver. it's giving chain reaction, iykyk π
Returns:
0on success β slay π-EINVALif the parameters are invalid, or if the post-configuration determines the driver has set the COMEDI device up incorrectly-ENOMEMif it failed to allocate memory π-EBUSYif it ran out of COMEDI minor device numbers- or some negative error number returned by the driver's
auto_attachhandler
ngl, that last one is just "whatever the driver says went wrong" β so don't be shocked if you get a number that isn't in this list π
π₯ SEE ALSO π₯
Kernel file ./drivers/comedi/drivers.c
comedi_set_hw_dev(9)comedi_alloc_devpriv(9)comedi_alloc_subdevices(9)comedi_alloc_subdev_readback(9)comedi_readback_insn_read(9)comedi_timeout(9)comedi_dio_insn_config(9)comedi_dio_update_state(9)comedi_bytes_per_scan_cmd(9)comedi_bytes_per_scan(9)comedi_nscans_left(9)comedi_nsamples_left(9)comedi_inc_scan_progress(9)comedi_handle_events(9)comedi_load_firmware(9)__comedi_check_request_region(9)comedi_check_request_region(9)comedi_legacy_detach(9)comedi_auto_unconfig(9)comedi_driver_register(9)comedi_driver_unregister(9)
and that's the whole page, bestie π
this lil gem lives at ./drivers/comedi and it's dated October 2026, so go forth and auto-config, mwah ππ
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms