【发布时间】:2015-05-09 18:54:50
【问题描述】:
所以我正在开发一个安卓应用程序。它使用红外线发射器向电视和其他东西发送信号。它在 CyanogenMod 11(Android 4.4.4)上运行良好,但在更新到 CyanogenMod 12(Android 5.0)后它停止工作。应用程序正在评估这些文件: /dev/ttyHSL2 和 /sys/devices/platform/ir_remote_control/enable 。通常他们的权限是好的,但更新后他们是“好的”但不是好的:/:
05-09 23:44:02.980 28282-28340/com.sssemil.ir E/libsonyir﹕ IRpowerOn : Error opaning power node /sys/devices/platform/ir_remote_control/enable error : Permission denied
05-09 23:44:03.981 28282-28340/com.sssemil.ir I/libsonyir﹕ IRserialOpen : CALLED
05-09 23:44:03.991 28282-28340/com.sssemil.ir E/libsonyir﹕ IRserialOpen : Error opaning serial device /dev/ttyHSL2 error : Permission denied
所以我尝试修复它们:
su -c "chmod 222 /sys/devices/platform/ir_remote_control/enable"
su -c "chmod 666 /dev/ttyHSL2"
还是一样的错误。然后我尝试了这个:
su -c "chmod 777 /sys/devices/platform/ir_remote_control/enable"
su -c "chmod 777 /dev/ttyHSL2"
还是什么都没有……我检查了权限,他们没问题:
shell@odin:/ $ su -c "ls -l /dev/ttyHSL2"
crwxrwxrwx system system 244, 2 2015-05-09 22:27 ttyHSL2
shell@odin:/ $ ls -l /sys/devices/platform/ir_remote_control/enable
-rwxrwxrwx system system 4096 2015-05-09 22:27 enable
所以如果有任何想法请帮助我。我的应用是开源的,如果你需要,这里是源代码https://github.com/sssemil/android_packages_apps_IRRemote。
谢谢。
【问题讨论】:
-
可能与 SE Linux (source.android.com/devices/tech/security/selinux) 权限有关?
-
除了一些遗留的例外,Android 的设计理念不是应用程序直接访问硬件资源 - 相反,系统守护进程会这样做,并且应用程序通常会在之后通过 Android 级 IPC 向它发出请求验证 Android 级别的权限。
-
嗯.. 看起来 j.holetzeck 是对的。将 SELinux 设置为 Permissive 会有所帮助。
标签: android linux android-5.0-lollipop android-4.4-kitkat infrared