LedService::LedService() { led_module_t* module; LOGI("ledserver->LedService: trying to get stub object"); if (hw_get_module(LED_HARDWARE_MODULE_ID, (const hw_module_t**)&module) == 0) { LOGI("ledserver->LedService: stub found."); if (led_control_open(&module->common, &sLedDevice) == 0) { LOGI("ledserver->LedService: ops not found."); return; } } LOGE("ledserver->LedService: failed to get LED stub"); return; }
static jboolean led_init(JNIEnv *env, jclass clazz){ struct led_module_t *module; LOGE("************Start find hal**************"); LOGE(LED_HARDWARE_MODULE_ID); if(hw_get_module(LED_HARDWARE_MODULE_ID, (const struct hw_module_t**)&module) == 0) { LOGI("LedService JNI: LED Stub found."); if(led_control_open(&module->hw_module, &led_hal_device) ==0){ LOGI("LedService JNI: LED Stub operation found."); return 0; } } LOGI("LedService JNI: LED Stub operation failed."); return -1; }
static jboolean mokoid_init(JNIEnv *env, jclass clazz) { led_module_t* module; LOGI("LedService JNI: mokoid_init() is invoked."); if (hw_get_module(LED_HARDWARE_MODULE_ID, (const hw_module_t**)&module) == 0) { LOGI("LedService JNI: LED Stub found."); if (led_control_open(&module->common, &sLedDevice) == 0) { LOGI("LedService JNI: Got Stub operations."); return 0; } } LOGE("LedService JNI: Get Stub operations failed."); return -1; }