On Mon, Dec 15, 2008 at 11:50 PM, Luca Belluccini <lucabellucc...@gmail.com> wrote: > > If I want to create a new device, conforming to Android HAL, I should > use one of the following approaches: > 1. App - Runtime Service - lib > 2. App - Runtime Service - Native Service - lib > 3. App - Runtime Service - Native Daemon - lib
It depends, most of the time you'll need to do something like: app -> java api (manager) -> java service -> HAL module -> kernel Sometimes (it's the case for the sensors), there is an extra native daemon, but in this particular case, it's an implementation detail (the sources for that daemon are proprietary). Sometimes, the "java service", can be replaced directly by a "native service", thanks to the binder interfaces (they're agnostic to the languages involved, so a service can even be rewritten from java to C++ or vice-versa, without breaking compatibility). In some cases, it is also possible to skip the "java service" entirely, if the HAL module can handle multiple clients and all the permissions involved. It is also possible to have a mix and match, this is the case for the sensors; the service is used to establish a connection with the hardware, but all the data moving is done by talking directly to the HAL module from the the app. So, in short, there are no rules. It depends on what you're trying to accomplish. mathias > Except for the existing devices, it is not easy to identify all the > files which need to be modified for adding a new one. > I am also interested in writing a User-Mode Driver, instead of using a > Kernel-Mode Driver model. > For now, I want to make it work in the emulator. > > My fake device will be similar to "sensor" device. > I tried to create a library calling it "fake" and managing all > necessary features. > I put them into /hardware/libhardware/fake, /hardware/libhardware/ > include/fake, with its Android.mk. > It relies on /dev/fake and /dev/input/fake (one for data, the second > one for control). > First question. There's a standard way in Android Project Group for > adding a new device (kernel and/or user model)? (Folders where files > should be placed, tips for makefiles, etc? The device /dev/input/ > compass is managed by which driver?) > There's a stub for implementing a new device and related Manager/ > Services, to higher levels up to Application? > Thank you in advance, > Luca Belluccini > > > --~--~---------~--~----~------------~-------~--~----~ unsubscribe: android-porting+unsubscr...@googlegroups.com website: http://groups.google.com/group/android-porting -~----------~----~----~----~------~----~------~--~---