Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I actually looked into the HAL/HIDL docs before posting and found no evidence that they are there to implement drivers in userspace.

As I understand it HALs and HIDL are used to provide a standardized way to implement new device features in a compatible way. So a vendor introduces a odor-sensor and can define an HIDL interface for the userspace to call the device driver provided in a kernel module.

I do not see a requirement to implement drivers in userspace, nor provisions for it, like interrupt handling, i2c/spi access or similar.



HIDL is the basis of Android IPC between processes, known as Binder.

"Binderized HALs. HALs expressed in HAL interface definition language (HIDL). These HALs replace both conventional and legacy HALs used in earlier versions of Android. In a Binderized HAL, the Android framework and HALs communicate with each other using binder inter-process communication (IPC) calls. All devices launching with Android 8.0 or later must support binderized HALs only.

Passthrough HALs. A HIDL-wrapped conventional or legacy HAL. These HALs wrap existing HALs and can serve the HAL in binderized and same-process (passthrough) modes. Devices upgrading to Android 8.0 can use passthrough HALs. "

https://source.android.com/devices/architecture/hal-types

Here are the user space driver APIs for i2c/spi access on Android Things.

https://developer.android.com/reference/com/google/android/t...


Android Things is not included in normal Android as it seems. Android Treble/9 is just not even close to a microkernel.

It if was, there would be documentation on how to write a userspace device driver, but there isn't.


Binder allows for endpoints in kernel space.


Of course, otherwise how would they support passthrough legacy HALs for devices upgrading to Oreo as described on the documentation?

Interprocess RPC is only for Oreo and newer.


The current HAL works via dynamic libraries that get loaded into your process and talk to kernel space with a platform specific API. The passthrough support is just opening both sides in the same process, loading those legacy libraries, and wrapping the libraries in the treble API. So it actually uses IPC where both sides are in user space. That's what they mean when they describe it as 'in process' in the documentation.

Going forward, I expect the vendors to modify their kernel drivers to export the treble API over binder IPC directly while in kernel space.

So I wouldn't be surprised if it ends up that interprocess RPC only ebds up getting used in systems before Oreo.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: