1,hw module
设备模块类型定义:
/hardware/libhardware/include/hardware/hardware.h
hardware.c
int hw_get_module(const char *id, const struct hw_module_t **module)
通过id获得module信息块--hmi
io和so名称匹配及so存放路径查找原则参考该函数实现。
2,打开设备
通过hmi的open方法打开设备
err = module->methods->open(module, id, &abstraction);
3,设备私有方法访问
使用前downcast到具体的设备模块类型:
bluetooth_module_t* btStack = (bluetooth_module_t *)abstraction;
调用模块自己的方法:
sBluetoothInterface = btStack->get_bluetooth_interface();
4,设备模块实现:
/external/bluetooth/bluedroid/btif/src/bluetooth.c