Android OS

Android 字符驱动#4#总结

2019-05-06  本文已影响0人  古风子

字符驱动架构图

前面几节已经将完整的例子讲完了,下面给出整体的架构图

[字符设备驱动demo架构图] 1JsCe6o.png

Linux内核源代码目录结构

显示kernel日志:

cat /dev/kmsg | grep HelloHal
cat /proc/kmsg | grep HelloHal

报错问题处理

问题1:
问题描述
../android/xxx/kernel-4.9 is not clean, please run 'make mrproper'
处理方法
https://blog.csdn.net/qidi_huang/article/details/53031488

问题2
问题描述

frameworks/support/v4/java/android/support/v4/media/TransportMediator.java:190: error: cannot access RemoteControlClient
        return mController != null ? mController.getRemoteControlClient() : null;
                                                ^
  class file for android.media.RemoteControlClient not found
frameworks/support/v4/java/android/support/v4/media/TransportMediator.java:240: error: cannot access OnPlaybackPositionUpdateListener
            mController.refreshState(mCallbacks.onIsPlaying(),
                       ^
  class file for android.media.RemoteControlClient$OnPlaybackPositionUpdateListener not found

处理方法:
You are using JDK8, for Android 6 you need JDK7.

export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64
export PATH=.:$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar

问题3

HelloServer不能访问/dev/hello设备,设置方法见 开发硬件访问服务-》修改SePolicy的权限

HelloHal fail open /dev/hello -- Permission denied

参考文档:

https://www.cnblogs.com/zhaobinyouth/p/6227644.html
https://www.cnblogs.com/liam999/p/5933827.html(系统service添加方法,包括权限声明)
https://blog.csdn.net/zrf1335348191/article/details/54907228
https://blog.csdn.net/wh_19910525/article/details/45170755(设置设备访问权限)

上一篇下一篇

猜你喜欢

热点阅读