I'm having a difficult time understanding when device drivers are needed, and when its fine to just talk directly to a port controller via the OS-provided serial/parallel/USB/etc. driver.
For instance, Example 1: let's take OpenBCI, an open source hardware BCI that allows you to read EEG + EKG ("brainwave") readings. The OpenBCI headset sends RF signals to a USB drive plugged into your machine, and then you can write your own software to read the data coming into that port; thus, allowing you to read your own brainwaves and interpret brainwave data at the app layer. Pretty cool. To read your "streaming" brainwave data, you need to not only read from your serial port (using the serial driver provided by the OS), but you need to interpret the data in according with the OpenBCI specs. So the stack looks like this:
But nowhere here do we have a "device driver" specific to the OpenBCI headset. Just the serial driver necessary to read bytes of data from, and then you need to interpret what those bytes mean from inside your app. So for instance, if I wanted a Java app to interpret brainwave data, I might use JSerialComm to read the data off my local COM port (or whatever USB is on the local system). It would then be up to my app to interpet that data per the specs listed above.
Now, Example 2: a Logitech USB webcam like this one. Here, you need to install the webcam's device drivers on your machine so that you can use it. I'm wondering why. Let's pretend (just push the "I believe!" button for a moment) that the pinout for this webcam was stupid simple:
PIN # Meaning =================== 1 Power 2 Ground 3 Send data (if 1 then the camera will start "streaming" its video data over data pins) 4 Data pin 1 5 Data pin 2
This is a USB device, just like the OpenBCI. So why couldn't I write an app (in any language) that also just reads/writes directly to the USB/serial port (again, perhaps using JSerialComm or similar)? When I want the app to start capturing webcam video data, I send bytes to the serial port (again via JSerialComm, etc.) that turn Pin #3 high/on, and that subsequently start reading the video data from Pins 4 and 5.
I guess I don't understand why OpenBCI doesn't have or need a device driver, whereas the webcam (or any other standard USB device like a printer, mouse, keyboard, etc.) does. Thanks in advance!