From: Johann D. <jo...@Do...> - 2001-06-19 19:01:38
|
Hi ! I am trying to clean up my addition about multiple open-with-write-access. My first idea was to use a flag, only_one_writer in struct evdev, and then perform the necessay checks in evdev_open and evdev_release. Vojtech suggested that we add a parameter to input_dev::open and pass that parameter to device drivers and let them decide. This would indeed allow for more flexibility. I thought that input_dev::close should be modified the same way. I tried to implement this, and while doing so, I noticed that it could be that input_dev::open and input_dev::close are not called the same number of times. This may or may not be a problem, I don't know. Here is a sample scenario: 1. Application 1 opens /dev/input/event0 2. Application 2 opens /dev/input/event0 (nothing forbids that) 3. evdev_disconnect is called (usb device is unplugged, input_attach is kiled...) Steps 1 and 2 call input_dev::open, step 3 calls input_dev::close. Now the question is: What is the role of input_dev::close/open ? Are they meant as "init/deinit the device" or "establish/break connection with processes" (or a mix of both) ? I would vote for the second possibility. By the way, if you add a step 4 to my scenario: 4. Application 1 or 2 writes to /dev/input/event0 then the application segfaults, and dmesg tells me someone tried to dereference a NULL pointer. -- Johann Deneux CS student at DoCS (www.docs.uu.se/~johannd) and ESIL (www.esil.univ-mrs.fr/~jdeneux) |