#define LOG_TAG "myled_hal"
#include <stdlib.h>
#include "hal_led.h"
#include <hardware/hardware.h>
#include <cutils/log.h>
int
mydev_close(
struct
hw_device_t* device){
struct
led_hal_device* tmp;
if
(device != NULL){
tmp = (
struct
led_hal_device*)device;
free
(tmp);
}
return
0;
}
int
mydev_open(){
return
0;
}
int
ledoff(){
return
0;
}
int
ledon(){
return
0;
}
int
myled_hal_open(
const
struct
hw_module_t* module,
const
char
* id,
struct
hw_device_t** device){
struct
led_hal_device *mydev = (
struct
led_hal_device *)
malloc
(
sizeof
(
struct
led_hal_device *));
if
(mydev == NULL){
LOGE(
"malloc error"
);
exit
(1);
}
mydev->common.tag = HARDWARE_DEVICE_TAG;
mydev->common.module = module;
mydev->common.version = 1;
mydev->common.close = mydev_close;
mydev->open = mydev_open;
mydev->ledoff = ledoff;
mydev->ledon = ledon;
*device = (
struct
hw_device_t*)mydev;
return
0;
}
static
struct
hw_module_methods_t myled_module_methods= {
open:myled_hal_open
};
struct
led_hal_modules HMI = {
common:{
tag: HARDWARE_MODULE_TAG,
version_major: 1,
version_minor: 0,
id: LED_MODULE_ID,
name:
"Graphics Memory Allocator Module"
,
author:
"The Android Open Source Project"
,
methods: &myled_module_methods,
},
};