android 学习记录待整理

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_26366149/article/details/79842683

JNI 向上提供本地函数,向下加载HAL文件并调用HAL 函数

HAL负责访问驱动程序执行硬件操作

HAL

1、dlopen加载    

    delopen(filename)


vendor/lib/hw   system/lib/hw

安卓的属性系统

led.XXX.so---->XXX就是某个属性值

hw_get_module("led")

  hw_module_exists()

JNI 怎么使用HAL

1、hw_get_module:获得hw_module_t的结构体

2、hw_module_t->methods->open()获得he_device_t

HAL 怎么写

1、实现一个名为HMI 的hw_module_t结构体

2、实现一个open 函数,返回一个设备自定义的结构体hw_device_t

可参考:hardware\libhardware\modules\vibrator\vibrator.c

猜你喜欢

转载自blog.csdn.net/qq_26366149/article/details/79842683