/dev/sg10 on linux is ignored due to a static list of names - RFC: Dynamically create a list of device nodes?
My system:
- OpenSuse Tumbleweed / sane-backends-1.2.1-1.3.x86_64
- Linux be10 6.4.12-1-default #1 (closed) SMP PREEMPT_DYNAMIC Fri Aug 25 08:26:31 UTC 2023 (f5aa89b) x86_64 x86_64 x86_64 GNU/Linux
- found SCSI scanner "FUJITSU fi-5120Cdj 0E00" at /dev/sg10 (with patched sane-find-scanner or explicit given name)
Problem: My scanner gets the device name /dev/sg10, which isn't yet in the static list of device names on linux (being /dev/sg[0-9a-z]).
My solution: Instead of just adding a number of static entries I had the idea to dynamically create a list of creating a list of scanner device nodes found in /dev/. This is a first try to do that and it's limited to sane-find-scanner.
What it does: Have a list of directories and functions to match the entries against a pattern. If the entry matches, it's returned as one of the possible device names.
7eggert/sane-backends@master...find-devnodes
That's off cause just a proof of concept. The new files don't yet follow the coding style and off cause the files will need to go to a different directory. I don't know enough about the project yet to go much further without advice.
My ideas:
- All programs should use the same mechanism
- maybe change it to return struct {devnode, type (SCSI|USB|parallel), what_else_would_be_useful}?
- the recursion should be part of this (currently the main program will do that for names ending in /)