当前位置:   article > 正文

Android增加系统服务访问底层硬件_android访问硬件服务

android访问硬件服务

一、以增加ActionService为例,首先在framework层增加几个文件

1、frameworks/base/services/java/com/android/server/ActionService.java

2、frameworks/base/core/java/android/app/IActionManager.aidl

3、frameworks/base/core/java/android/app/ActionManager.java

4、frameworks/base/services/core/jni/com_android_server_ActionService.cpp

  1. package com.android.server;
  2. import android.app.ActionManager;
  3. import android.app.IActionManager;
  4. public class ActionService extends IActionManager.Stub {
  5. private static native boolean init_native();
  6. private static native void setIR_native(int val);
  7. private static native void setLedColor_native(int val);
  8. private static final String TAG = "ActionService";
  9. private Context mContext;
  10. private static boolean launcherHasStart = false;
  11. public ActionService(Context context) {
  12. mContext = context;
  13. //Log.e(TAG, "I am handling ACTION_SERVICE init service. added by zs 20180517 for test start to register service");
  14. }
  15. @Override
  16. public void init(){
  17. init_native();
  18. }
  19. @Override
  20. public void setIR(int status) {
  21. setIR_native(status);
  22. }
  23. @Override
  24. public void setLedColor(int status) {
  25. //Log.i(TAG,"---------->>>>yxj add: call setLedColor()");
  26. setLedColor_native(status);
  27. }
  28. }
  1. /* //device/java/android/android/app/IAlarmManager.aidl
  2. **
  3. ** Copyright 2006, The Android Open Source Project
  4. **
  5. ** Licensed under the Apache License, Version 2.0 (the "License");
  6. ** you may not use this file except in compliance with the License.
  7. ** You may obtain a copy of the License at
  8. **
  9. ** http://www.apache.org/licenses/LICENSE-2.0
  10. **
  11. ** Unless required by applicable law or agreed to in writing, software
  12. ** distributed under the License is distributed on an "AS IS" BASIS,
  13. ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. ** See the License for the specific language governing permissions and
  15. ** limitations under the License.
  16. */
  17. package android.app;
  18. /*
  19. import android.app.PendingIntent;
  20. */
  21. /**
  22. * System private API for talking with the action manager service.
  23. *
  24. * {@hide}
  25. */
  26. interface IActionManager {
  27. void init();
  28. void setIR(int status);
  29. void setLedColor(int status);
  30. }
  1. package android.app;
  2. import android.content.Context;
  3. import android.content.Intent;
  4. import android.os.RemoteException;
  5. import android.os.ServiceManager;
  6. import android.app.IActionManager;
  7. import android.util.Log;
  8. /**
  9. * @hide
  10. */
  11. public class ActionManager {
  12. private static IActionManager mService;
  13. private Context mContext;
  14. private static final String TAG = "ActionManager";
  15. ActionManager(Context context, IActionManager service) {
  16. mService = service;
  17. mContext = context;
  18. }
  19. /*
  20. function: set IR on/off
  21. parm:1 is on, 0 is off
  22. */
  23. public void setIR(int status) {
  24. try {
  25. mService.setIR(status);
  26. } catch (RemoteException ex) {
  27. }
  28. }
  29. /*
  30. function: set led color
  31. parm:1 is blue color, 0 is red
  32. */
  33. public void setLedColor(int status) {
  34. try {
  35. //Log.i(TAG, "--------->>>>yxj add: setLedColor = " + status);
  36. mService.setLedColor(status);
  37. } catch (RemoteException ex) {
  38. }
  39. }
  40. }
  1. #define LOG_TAG "ActionService"
  2. #include "jni.h"
  3. #include "JNIHelp.h"
  4. #include "android_runtime/AndroidRuntime.h"
  5. #include <utils/misc.h>
  6. #include <utils/Log.h>
  7. #include <hardware/hardware.h>
  8. #include <hardware/action.h>
  9. #include <stdio.h>
  10. namespace android
  11. {
  12. struct action_device_t* action_device = NULL;
  13. static inline int action_device_open(const hw_module_t* module, struct action_device_t** device) {
  14. return module->methods->open(module, ACTION_HARDWARE_MODULE_ID, (struct hw_device_t**)device);
  15. }
  16. static jboolean action_init(JNIEnv* env, jclass /* clazz */) {
  17. action_module_t* module;
  18. //ALOGI("------------->>>>yxj add: *action JNI: initializing......");
  19. if(hw_get_module(ACTION_HARDWARE_MODULE_ID, (const struct hw_module_t**)&module) == 0) {
  20. ALOGI("------------->>>>yxj add: action JNI: action Stub found.");
  21. if(action_device_open(&(module->common), &action_device) == 0) {
  22. ALOGI("------------->>>>yxj add: action JNI: action device is open.");
  23. return 1;
  24. }
  25. ALOGE("------------->>>>yxj add: action JNI: failed to open action device.");
  26. return 0;
  27. }
  28. ALOGE("------------->>>>yxj add: action JNI: failed to get action stub module.");
  29. return 0;
  30. }
  31. static void set_IR(JNIEnv* env, jobject clazz, jint value) {
  32. // int val = 0; //masked by zs 20180515
  33. if(!action_device) {
  34. ALOGI("------------->>>>yxj add: action JNI: device is not open.");
  35. return ;
  36. }
  37. //ALOGI("------------->>>>yxj add: action JNI: set_IR to device location1.");
  38. action_device->setIR(action_device, value);
  39. // ALOGI("------------->>>>yxj add: action JNI: set_IR to device. location2");
  40. }
  41. static void set_led_color(JNIEnv* env, jobject clazz, jint value) {
  42. //ALOGI("------------->>>>yxj add: action JNI: set value %d to device.", value);
  43. if(!action_device) {
  44. ALOGI("------------->>>>yxj add: action JNI: device is not open.");
  45. return;
  46. }
  47. action_device->setLedColor(action_device, value);
  48. }
  49. /*JNI 方法表*/
  50. static const JNINativeMethod method_table[] = {
  51. {"init_native", "()Z", (void*)action_init},
  52. {"setIR_native", "(I)V", (void*)set_IR},
  53. {"setLedColor_native", "(I)V", (void*)set_led_color},
  54. };
  55. /*注册JNI 方法*/
  56. int register_android_server_ActionService(JNIEnv *env) {
  57. return jniRegisterNativeMethods(env, "com/android/server/ActionService", method_table, NELEM(method_table) );
  58. }
  59. };

二、注册与添加服务

1、在frameworks/base/services/core/jni/onload.cpp文件中的两个方法中分别添加:

int register_android_server_ActionService(JNIEnv* env);

register_android_server_ActionService(env);

2、在frameworks/base/services/java/com/android/server/SystemServer.java文件中startOtherServices()方法中添加

try {
                    ServiceManager.addService(Context.ACTION_SERVICE, new ActionService(context));
} catch (Throwable e) {
                    Slog.e(TAG, "Failure starting action Service", e);
}

3、frameworks/base/services/core/jni/Android.mk文件中增加:

$(LOCAL_REL_DIR)/com_android_server_ActionService.cpp \

4、frameworks/base/core/java/android/content/Context.java文件中增加:

public static final String ACTION_SERVICE = "action";

5、frameworks/base/core/java/android/app/SystemServiceRegistry.java文件增加

registerService(Context.ACTION_SERVICE, ActionManager.class,
                new CachedServiceFetcher<ActionManager>() {
            @Override
                public ActionManager createService(ContextImpl ctx) {
                        IBinder b = ServiceManager.getService(Context.ACTION_SERVICE);
                        IActionManager service = IActionManager.Stub.asInterface(b);
                        return new ActionManager(ctx.getOuterContext(), service);
            }});

6、文件frameworks/base/Android.mk中增加

core/java/android/app/IActionManager.aidl \

7、文件device/rockchip/common/device.mk增加

PRODUCT_PACKAGES += action.default

 

三、底层相关修改:

1、添加文件hardware/libhardware/include/hardware/action.h

hardware/libhardware/modules/action/action.c

hardware/libhardware/modules/action/Android.mk

  1. #ifndef ANDROID_action_INTERFACE_H
  2. #define ANDROID_action_INTERFACE_H
  3. #include <hardware/hardware.h>
  4. __BEGIN_DECLS
  5. #define ACTION_HARDWARE_MODULE_ID "action"
  6. struct action_module_t {
  7. struct hw_module_t common;
  8. };
  9. struct action_device_t {
  10. struct hw_device_t common;
  11. int fd;
  12. int (*setIR)(struct action_device_t* dev, int val);
  13. int (*setLedColor)(struct action_device_t* dev, int val);
  14. };
  15. __END_DECLS
  16. #endif
  1. #define LOG_TAG "ActionHAL"
  2. #include <hardware/hardware.h>
  3. #include <hardware/action.h>
  4. #include <stdio.h>
  5. #include <stdlib.h>
  6. #include <fcntl.h>
  7. #include <errno.h>
  8. #include <cutils/log.h>
  9. #include <cutils/atomic.h>
  10. #include <linux/ioctl.h>
  11. #include <linux/types.h>
  12. #define MODULE_NAME "action"
  13. #define MODULE_AUTHOR "action"
  14. #define DEVICE_NAME "/dev/action_dev"
  15. #define SET_AUDIO_SOUCE 1
  16. #define SET_FM_FREQ 3
  17. #define SET_FM_STATUS 5
  18. #define SET_IR 7
  19. #define SET_VOLUME 9
  20. #define SET_LED_COLOR 11
  21. #define SET_IR_BAND 13
  22. #define SET_ENABLE_BACKLIGHT 15
  23. #define SET_HMDI_RESET 17
  24. static int action_device_open(const struct hw_module_t* module, const char* name, struct hw_device_t** device);
  25. static int action_device_close(struct hw_device_t* device);
  26. static int set_IR(struct action_device_t* dev, int val);
  27. static int set_led_color(struct action_device_t* dev, int val);
  28. static struct hw_module_methods_t action_module_methods = {
  29. open: action_device_open
  30. };
  31. struct action_module_t HAL_MODULE_INFO_SYM = {
  32. common: {
  33. tag: HARDWARE_MODULE_TAG,
  34. version_major: 1,
  35. version_minor: 0,
  36. id: ACTION_HARDWARE_MODULE_ID,
  37. name: MODULE_NAME,
  38. author: MODULE_AUTHOR,
  39. methods: &action_module_methods,
  40. }
  41. };
  42. static int action_device_open(const struct hw_module_t* module, const char* name, struct hw_device_t** device) {
  43. struct action_device_t* dev;
  44. //ALOGD("------------->>>>yxj add: %s", __FUNCTION__);
  45. dev = (struct action_device_t*)malloc(sizeof(struct action_device_t));
  46. if(!dev) {
  47. return -EFAULT;
  48. }
  49. memset(dev, 0, sizeof(struct action_device_t));
  50. dev->common.tag = HARDWARE_DEVICE_TAG;
  51. dev->common.version = 0;
  52. dev->common.module = (hw_module_t*)module;
  53. dev->common.close = action_device_close;
  54. dev->setIR = set_IR;
  55. dev->setLedColor = set_led_color;
  56. dev->fd = open("/dev/action_dev", O_RDWR);
  57. if((dev->fd) < 0)
  58. {
  59. ALOGD("------------->>>>yxj add: open /dev/action_dev fail: error = %s\n", strerror(errno));
  60. free(dev);
  61. return -EFAULT;
  62. }
  63. //ALOGD("------------->>>>yxj add: %s, dev->fd = %d", __FUNCTION__, dev->fd);
  64. *device = &(dev->common);
  65. return 0;
  66. }
  67. static int action_device_close(struct hw_device_t* device) {
  68. struct action_device_t* action_device = (struct action_device_t*)device;
  69. if(action_device) {
  70. close(action_device->fd);
  71. free(action_device);
  72. }
  73. return 0;
  74. }
  75. static int set_IR(struct action_device_t* dev, int val) {
  76. //ALOGD("------------->>>>yxj add: %s, %d", __FUNCTION__, val);
  77. ioctl(dev->fd, SET_IR, val);
  78. return 0;
  79. }
  80. static int set_led_color(struct action_device_t * dev, int val){
  81. //ALOGD("------------->>>>yxj add: %s, %d", __FUNCTION__, val);
  82. ioctl(dev->fd, SET_LED_COLOR, val);
  83. return 0;
  84. }
  1. LOCAL_PATH := $(call my-dir)
  2. include $(CLEAR_VARS)
  3. LOCAL_MODULE_TAGS := optional
  4. LOCAL_PRELINK_MODULE := false
  5. LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw
  6. LOCAL_SHARED_LIBRARIES := liblog libcutils
  7. LOCAL_SRC_FILES := action.c
  8. LOCAL_MODULE := action.default
  9. include $(BUILD_SHARED_LIBRARY)

2、在文件system/core/rootdir/ueventd.rc中增加

/dev/action_dev          0666   system     system

3、hardware/libhardware/modules/Android.mk文件hardware_modules中增加

action

4、device/rockchip/common/sepolicy/system_server.te文件增加

allow system_server action_device:chr_file rw_file_perms;

5、device/rockchip/common/sepolicy/service.te增加

type action_service, system_server_service, service_manager_type;

6、device/rockchip/common/sepolicy/service_contexts增加

action                 u:object_r:action_service:s0

7、device/rockchip/common/sepolicy/file_contexts增加

/dev/action_dev                u:object_r:action_device:s0

8、device/rockchip/common/sepolicy/device.te

type action_device, dev_type;

9、增加文件kernel/drivers/char/action/action_dev.c

  1. /*
  2. * File:
  3. */
  4. #include <linux/kernel.h>
  5. #include <linux/module.h>
  6. #include <linux/fs.h>
  7. #include <asm/uaccess.h>
  8. #include <linux/ioctl.h>
  9. #include <linux/device.h>
  10. #include <asm/io.h>
  11. #include <linux/delay.h>
  12. #include <asm/mach-types.h>
  13. #include <linux/of.h>
  14. #include <linux/of_device.h>
  15. #include <linux/platform_device.h>
  16. #include <linux/of_gpio.h>
  17. #include <linux/slab.h>
  18. #include <linux/mutex.h>
  19. #define ACTION_DEV_MAJOR_NUM 235
  20. #define ACTION_DEV_MINOR_NUM 1
  21. #define SET_AUDIO_SOUCE 1
  22. #define SET_FM_FREQ 3
  23. #define SET_FM_STATUS 5
  24. #define SET_IR 7
  25. #define SET_VOLUME 9
  26. #define SET_LED_COLOR 11
  27. #define SET_IR_BAND 13
  28. #define SET_ENABLE_BACKLIGHT 15
  29. #define SET_HMDI_RESET 17
  30. #define DEV_NAME "action_dev"
  31. struct led_data{
  32. struct delayed_work work;
  33. int led_flag;
  34. int stop_flash_flag;
  35. struct mutex mutex;
  36. };
  37. static struct class *action_class;
  38. static int ir_gpio, ir_gpio1, ir_gpio2, fm_ctl_gpio, hdmi_5v_gpio, led_gpio, detect_hw_version;
  39. static int first_set_ir_flag = 0;
  40. static struct workqueue_struct *led_workqueue = NULL;
  41. static struct led_data *action_led = NULL;
  42. extern int sleep_gpio;
  43. extern void set_current_source(int source);
  44. extern void set_fmkqn800_status(int status);
  45. extern void set_fmkqn800_freq(int freq);
  46. extern void adjust_volume(int volume);
  47. extern bool Check_Adv7181_Singal(void);
  48. //extern void Adv7181ModeChange(int val);
  49. extern void set_system_boot_finish_to_enable_backlight(int val);
  50. static int action_dev_open(struct inode *inode, struct file *file)
  51. {
  52. return 0;
  53. }
  54. static int action_dev_release(struct inode *inode, struct file *file)
  55. {
  56. return 0;
  57. }
  58. static int action_dev_read(struct file *file, char __user *buf, size_t count,
  59. loff_t *offset)
  60. {
  61. int disc_gpio, ret, detect_hw_version_gpio;
  62. disc_gpio = gpio_get_value(hdmi_5v_gpio);
  63. if(Check_Adv7181_Singal()==true)
  64. disc_gpio = disc_gpio | 0x00000010;
  65. detect_hw_version_gpio = gpio_get_value(detect_hw_version);
  66. disc_gpio = disc_gpio | (detect_hw_version_gpio << 8);
  67. ret = copy_to_user(buf, &disc_gpio, count) ? -EFAULT : ret;;
  68. return ret;
  69. }
  70. static long action_dev_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
  71. {
  72. int ret = 0;
  73. int parm = (int)arg;
  74. switch(cmd){
  75. case SET_AUDIO_SOUCE:
  76. //printk("-------->>>>yxj add: SET_AUDIO_SOUCE, parm = %d\n", parm);
  77. set_current_source(parm);
  78. break;
  79. case SET_FM_STATUS:
  80. //printk("-------->>>>yxj add: SET_FM_STATUS, parm = %d\n", parm);
  81. if(parm == 1){
  82. gpio_direction_output(fm_ctl_gpio, 1);
  83. msleep(200);
  84. set_fmkqn800_status(parm);
  85. }
  86. else if(parm == 0){
  87. set_fmkqn800_status(parm);
  88. gpio_direction_output(fm_ctl_gpio, 0);
  89. }
  90. else
  91. {
  92. //Adv7181ModeChange(parm);
  93. }
  94. /*else if(parm == 3){
  95. // set_fmkqn800_status(parm);
  96. Adv7181ModeChange(1);
  97. //gpio_direction_output(fm_ctl_gpio, 0);
  98. }
  99. else if(parm == 4){
  100. // set_fmkqn800_status(parm);
  101. Adv7181ModeChange(0);
  102. //gpio_direction_output(fm_ctl_gpio, 0);
  103. }*/
  104. break;
  105. case SET_FM_FREQ:
  106. set_fmkqn800_freq(parm);
  107. break;
  108. case SET_IR:
  109. if(first_set_ir_flag == 0)
  110. {
  111. gpio_direction_output(ir_gpio, 1);
  112. first_set_ir_flag = 1;
  113. }
  114. if(parm == 1){
  115. gpio_direction_output(ir_gpio1, 1);
  116. }
  117. else{
  118. gpio_direction_output(ir_gpio1, 0);
  119. }
  120. break;
  121. case SET_VOLUME:
  122. adjust_volume(parm);
  123. break;
  124. case SET_LED_COLOR:
  125. action_led->stop_flash_flag = 1;
  126. mutex_lock(&action_led->mutex);
  127. if(parm == 1){
  128. gpio_direction_output(led_gpio, 0);
  129. }
  130. else{
  131. gpio_direction_output(led_gpio, 1);
  132. }
  133. mutex_unlock(&action_led->mutex);
  134. break;
  135. case SET_IR_BAND:
  136. if(parm == 1){
  137. gpio_direction_output(ir_gpio2, 1); //A band
  138. }
  139. else{
  140. gpio_direction_output(ir_gpio2, 0); //B band
  141. }
  142. break;
  143. case SET_ENABLE_BACKLIGHT:
  144. set_system_boot_finish_to_enable_backlight(parm);
  145. break;
  146. case SET_HMDI_RESET:
  147. if(parm == 1){
  148. gpio_direction_output(sleep_gpio, 1);
  149. }
  150. else{
  151. gpio_direction_output(sleep_gpio, 0);
  152. }
  153. break;
  154. default:
  155. break;
  156. }
  157. return ret;
  158. }
  159. struct file_operations action_dev_ops = {
  160. .owner = THIS_MODULE,
  161. .unlocked_ioctl = action_dev_ioctl,
  162. .open = action_dev_open,
  163. .read = action_dev_read,
  164. .release = action_dev_release,
  165. };
  166. static struct of_device_id action_dt_match[] = {
  167. { .compatible = "action, action_dev", },
  168. };
  169. MODULE_DEVICE_TABLE(of, action_dt_match);
  170. static void led_work_func(struct work_struct *work)
  171. {
  172. if(action_led->stop_flash_flag == 1)
  173. return;
  174. mutex_lock(&action_led->mutex);
  175. if(action_led->led_flag == 1){
  176. gpio_direction_output(led_gpio, 1);
  177. action_led->led_flag = 0;
  178. }else{
  179. gpio_direction_output(led_gpio, 0);
  180. action_led->led_flag = 1;
  181. }
  182. mutex_unlock(&action_led->mutex);
  183. queue_delayed_work(led_workqueue, &action_led->work, 300);
  184. }
  185. static int action_probe(struct platform_device *pdev)
  186. {
  187. int ret;
  188. struct device_node *np = (&(pdev->dev))->of_node;
  189. action_led = kzalloc(sizeof(*action_led), GFP_KERNEL);
  190. if (action_led == NULL)
  191. {
  192. printk("Alloc GFP_KERNEL memory failed.");
  193. return -ENOMEM;
  194. }
  195. INIT_DELAYED_WORK(&action_led->work, led_work_func);
  196. mutex_init(&action_led->mutex);
  197. ir_gpio = of_get_named_gpio(np, "ir_gpio", 0);
  198. ir_gpio1 = of_get_named_gpio(np, "ir_gpio1", 0);
  199. ir_gpio2 = of_get_named_gpio(np, "ir_gpio2", 0);
  200. fm_ctl_gpio = of_get_named_gpio(np, "fm_ctl_gpio", 0);
  201. hdmi_5v_gpio = of_get_named_gpio(np, "hdmi_5v_gpio", 0);
  202. led_gpio = of_get_named_gpio(np, "led_gpio", 0);
  203. detect_hw_version = of_get_named_gpio(np, "detect_hw_version", 0);
  204. gpio_request(ir_gpio, "ir_gpio");
  205. gpio_request(ir_gpio1, "ir_gpio1");
  206. gpio_request(ir_gpio2, "ir_gpio2");
  207. gpio_request(fm_ctl_gpio, "fm_ctl_gpio");
  208. gpio_request(hdmi_5v_gpio, "hdmi_5v_gpio");
  209. gpio_request(led_gpio, "led_gpio");
  210. gpio_request(detect_hw_version, "detect_hw_version");
  211. gpio_direction_output(ir_gpio, 0);
  212. gpio_direction_output(ir_gpio2, 1);
  213. gpio_direction_input(hdmi_5v_gpio);
  214. gpio_direction_input(detect_hw_version);
  215. //gpio_direction_output(fm_ctl_gpio, 1);//added by zs for test
  216. ret = register_chrdev(ACTION_DEV_MAJOR_NUM, DEV_NAME, &action_dev_ops);
  217. action_class = class_create(THIS_MODULE, DEV_NAME);
  218. device_create(action_class, NULL, MKDEV(ACTION_DEV_MAJOR_NUM, ACTION_DEV_MINOR_NUM), NULL, DEV_NAME);
  219. if(ret < 0){
  220. printk("---->>>yxj add: [%d]fail to register the character device\n", ret);
  221. return ret;
  222. }
  223. queue_delayed_work(led_workqueue, &action_led->work, 100);
  224. return 0;
  225. }
  226. static int action_remove(struct platform_device *pdev)
  227. {
  228. unregister_chrdev(ACTION_DEV_MAJOR_NUM, DEV_NAME);
  229. return 0;
  230. }
  231. static struct platform_driver action_driver = {
  232. .probe = action_probe,
  233. .remove = action_remove,
  234. .driver = {
  235. .name = DEV_NAME,
  236. .owner = THIS_MODULE,
  237. .of_match_table = action_dt_match,
  238. },
  239. };
  240. int __init action_init(void)
  241. {
  242. int retval;
  243. led_workqueue = create_singlethread_workqueue("led_wq");
  244. if (!led_workqueue)
  245. {
  246. printk("Creat workqueue failed.");
  247. return -ENOMEM;
  248. }
  249. retval = platform_driver_register(&action_driver);
  250. return retval;
  251. }
  252. void __exit action_exit(void)
  253. {
  254. cancel_delayed_work(&action_led->work);
  255. flush_workqueue(led_workqueue);
  256. kfree(action_led);
  257. destroy_workqueue(led_workqueue);
  258. platform_driver_unregister(&action_driver);
  259. }
  260. module_init(action_init);
  261. module_exit(action_exit);
  262. MODULE_AUTHOR("action team");
  263. MODULE_DESCRIPTION("ation_dev");
  264. MODULE_LICENSE("GPL");

10、kernel/arch/arm/boot/dts/rk3288-evb-android-rk808-lvds.dts中增加

action_dev {
        compatible = "action, action_dev";
        status = "okay";
        ir_gpio = <&gpio7  11  GPIO_ACTIVE_HIGH>;
        ir_gpio1 = <&gpio7  13  GPIO_ACTIVE_HIGH>;
        ir_gpio2 = <&gpio7  14  GPIO_ACTIVE_HIGH>;
        fm_ctl_gpio = <&gpio7  15  GPIO_ACTIVE_HIGH>;
        hdmi_5v_gpio = <&gpio5  14  GPIO_ACTIVE_HIGH>;
        led_gpio = <&gpio7 12 GPIO_ACTIVE_HIGH>;
        detect_hw_version = <&gpio5 10 GPIO_ACTIVE_HIGH>;
    };

11、kernel/.config   kernel/.config.old   kernel/arch/arm/configs/rockchip_defconfig 增加

CONFIG_ACTION_CHAR_DEV=y

12、kernel/drivers/char/Kconfig增加

source "drivers/char/action/Kconfig"

13、kernel/drivers/char/Makefile增加

obj-$(CONFIG_ACTION_CHAR_DEV)  += action/

14、增加文件

  1. #
  2. # action character device configuration
  3. #
  4. menu "Action character device"
  5. config ACTION_CHAR_DEV
  6. bool "ACTION CHAR DEV"
  7. default y
  8. help
  9. ACTION CHAR DEV driver.
  10. endmenu

 

15、增加文件

#
# drivers/char/action/Makefile
#

obj-$(CONFIG_ACTION_CHAR_DEV) += action_dev.o
obj-$(CONFIG_FMK9N800) += fmk9n800.o
obj-$(CONFIG_ACTION_CH7107) += ch7107.o

16、kernel/include/config/auto.conf增加

CONFIG_ACTION_CHAR_DEV=y

17、kernel/include/config/auto.conf.cmd增加

drivers/char/action/Kconfig \

18、kernel/include/generated/autoconf.h增加

#define CONFIG_ACTION_CHAR_DEV 1

 

 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/我家自动化/article/detail/311022
推荐阅读
相关标签
  

闽ICP备14008679号