maemo.org Bugzilla – Bug 5329
Provide real accelerometer device (via /dev/input* devices) instead of forcing D-Bus
Last modified: 2009-11-05 11:17:50 UTC
You need to log in before you can comment on or make changes to this bug.
SOFTWARE VERSION: 1.2009.41-10 STEPS TO REPRODUCE THE PROBLEM: Try using accelerometer API from an application EXPECTED OUTCOME: There is a /dev/accelerometer device that can be opened and repeatedly read, with read() or ioctl(). It returns accelerometer data in binary format. The accelerometer is powered down once all instances of the device are closed. It is powered up when someone opens the device. ACTUAL OUTCOME: There are two APIs for accessing the accelerometer: the DBus and the SYSFS. The first one requires the programmer to initialize and support DBus in his application. The second one requires the programmer to repeatedly open/close the file and parse character strings. Enabling/disabling the accelerometer is now only possible via DBus call. REPRODUCIBILITY: always
/dev/accelerometer would be BAD (tm) as it would not be standard linux API. Instead it should be a input device like all the other lis3lv02 accelerometers supported by linux.
(In reply to comment #1) > /dev/accelerometer would be BAD (tm) as it would not be standard linux API. > Instead it should be a input device like all the other lis3lv02 accelerometers > supported by linux. If there is a standard device-based API already, I fully support using that API.
So what is the exact proposal here if /dev/accelerometer is not good? And what are good reasons for a developer to NOT use the existing D-Bus interface? Please elaborate - with real usecases it's way easier to convince people.
(In reply to comment #3) > So what is the exact proposal here if /dev/accelerometer is not good? The current Linux support for accelerometers works via /dev/input* devices. For details on this support, check out /usr/include/linux/input.h and the related documentation on the Net. Basically, there is a possibility to return rotation events for all three axis. The accelerometer should generate these events. > And what are good reasons for a developer to NOT use the existing D-Bus > interface? > Please elaborate - with real usecases it's way easier to convince people. The DBus interface requires you to initialize and support DBus API in your software. Furthermore, using DBus costs more than opening and reading a simple device file. Finally, you need separate DBus messages to actually read the accelerometer and to indicate that you are using/not-using it. As there is a simple, standard, and well known input events based API for accelerometers in Linux, creating convoluted DBus-bound API makes no technical sense.
Additional justification for NOT using DBus, quoting from Maemo Development Guide at http://maemo.org/maemo_release_documentation/maemo4.1.x/node16.html#SECTION001633100000000000000 "The D-BUS system bus should not be used for heavy messaging or regular transfers of large amounts of data, because it slows down the communication of other processes and requires extra processing power (and with it, electrical power). For that purpose, using a Unix socket, pipe, shared memory or file should be considered."
(In reply to comment #3) > So what is the exact proposal here if /dev/accelerometer is not good? > And what are good reasons for a developer to NOT use the existing D-Bus > interface? 1) Quering the orientation over dbus causes way too much latency. 2) the dbus api is non-standard, requiring extra porting effort in case of application already supports accelerometers.
(In reply to comment #4) > As there is a simple, standard, and well known input events based API for > accelerometers in Linux Any URLs describing this/providing more info?
(In reply to comment #7) > (In reply to comment #4) > > As there is a simple, standard, and well known input events based API for > > accelerometers in Linux > Any URLs describing this/providing more info? Check input and joystick documents here: http://www.mjmwired.net/kernel/Documentation/input The accelerometer is basically a 3-axis analog joystick. Really adventurous may consider adding proximity sensor, kickstand switch, and/or camera switch as joystick "buttons".
*** This bug has been confirmed by popular vote. ***