Need help filling in some knowledge gaps on driver use in user applications. I have a digital IO driver. I compile the driver and install it on boot with modprobe and when i check in /dev I can see /dev/digitalIOa. If i check lsmod i can see digitalIO is loaded.
1st knowledge gap:
So it looks like the driver's init_module function simply created a default device file for me and named it digitalIOa?
2nd knowledge gap: The driver's documentation specifies it can support up to 4 devices (digitalIOa, digitalIOb, digitalIOc, digitalIOd) i believe based upon the number of chips present. I only have one, thus I only get digitalIOa. I was under the impression that a single driver, e.g. digitalIO can/should support many devices (device files?) using the driver's major number and assigning them minor numbers. So, in this context is the fact that the, what I am assuming is a default device file, named digitalIOa just a coincidence or does this driver in fact only support creating a single device file (which doesn't seem likely)?
3rd knowledge gap: digitalIO driver's API that my user application links to has expected function calls like: write_byte, read_byte, etc, but I do not see anything like "add device()". The file ops structure contains open() but I'm failing to understand how to use this. I tried a manual approach to get things moving by logging on to my target and issuing mknod calls with the major number of digitalIO listed in /dev and a minor number and gave the device files names i wanted. they created just fine. The user application fails to open the device files I created. I do not recall the error it gave me but if someone thinks that the manual approach i used should have worked I can edit the post and add the error.
I want to create more device files in a sub directory of dev e.g. /dev/myuserapp/myDigiHello_1, /dev/myuserapp/myDigiHello_2, /dev/myuserapp/myDigiHello_n. Need a some direction for getting the user application to open up these device files for use.