Passing data from Kspace to Uspace
I am new to linux world, my background so far has been on RTOSs like VxWorks.
Currently I am tasked with writing a driver for a sensor. Driver talks to device over I2C Bus.
The way I am trying to design is,
I will make driver module part of the kernel so that it will be loaded with the kernel runs. Its probe will register with evdev(input susbsystem), create attribute (coordinates) for i2c client and register its read and store routines.
once the sensor crosses the threshold, it will issue INT, ISR will read x,y,z over I2C Bus and executes write on coordinates. Store function captures x,y & z and pushes out to input subsystem.
Now my question is can I have a process in userspace that is pended on read(/dev/input/eventX,...,...) that will wake up once it gets the data, processes it and goes back to sleep again.
Reason i want to do it this way is to differ processing to user space process rather than doing it in ISR.
The problem here is the process would have to be started after the drivers probe registers with event subsystem since process is pending on /dev/input/eventX
Can anyone suggest how should I go by implementing this.