Does the driver know any information about the application that called open?
I’m using a driver to support 2 similar but different devices. I want to be able to specify which particular device to use when I call open in an application. I am using symlinks for each device linking it to the driver’s name so that I can call open("/dev/dev1"... or open("/dev/dev2"... instead of open("/dev/drivername"... and would like to be able to use this symlink name in the open function if that’s somehow possible.
No, this doesn’t work. The driver doesn’t get any information about the path used to open the node. Device nodes are specified by major/minor numbers and a character/block type, and that’s it. If you want your different “named” nodes to be distinguishable, presumably they should have different minor numbers.