get_valid_routes(9)
π get_valid_routes(9) β the Kernel API Manual page, but make it make sense π
okay so bestie, welcome to the glow-up of get_valid_routes(9) from the Kernel API Manual β¨ this is the little helper that rings up your low-level driver's own get_valid_routes function and asks it to either hand back a count of valid routes to userspace or copy the whole list of all valid device routes into a userspace buffer π¦ two jobs, one function, main character energy fr fr π
β¨ SYNOPSIS β¨
int get_valid_routes (struct comedi_device *dev , unsigned int *data );
that's it, that's the whole vibe check π no cap πΈ
π«Ά ARGUMENTS π«Ά
devβ a comedi device pointer π your ticket to the device, basically.dataβ the data from the userinsncall. Now listen, this one's the whole personality, so let's break it down π§:- the length of
datamust be>= 2β not optional, lowkey non-negotiable π data[0]must contain theINSN_DEVICE_CONFIGconfig_idβ that's the whole point of showing up πdata[1](input) contains the number of pairs that memory is allotted for from the user. so it's pairs, not routes-singular, keep up bestie π- if the user specifies
'0'there, then only the number of pairs available is returned β no copying, just the count, like a little peek π₯ data[1](output) returns either the number of pairs available (if none were requested) or the number of pairs that actually got copied back to the user βdata[2::2]returns each(source, destination)pair π¦ so it's the pair list, strutting out two at a time π
- the length of
ngl the data[1] slot is doing double duty as input and output and honestly it's giving versatility, we stan π β just remember which direction the info is flowing in at any given moment, bestie π
πΈ RETURN πΈ
-EINVALβ if the low-level driver does not allocate and return routes as expected. iykyk, the driver didn't slay π0β returned otherwise. success, periodt π
π SEE ALSO π
these are the girlies in the same friend group, go say hi β¨
- Kernel file
./drivers/comedi/comedi_fops.c struct comedi_file(9)comedi_dev_put(9)comedi_dev_get_from_minor(9)comedi_is_subdevice_running(9)comedi_get_is_subdevice_running(9)comedi_put_is_subdevice_running(9)comedi_set_spriv_auto_free(9)comedi_alloc_spriv(9)comedi_event(9)
and that's the page, bestie π«Ά this little icon comes from ./drivers/comedi, dated October 2026, and it's filed under get_valid_routes(9) forever π 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