我正在开发一款安卓应用程序,它使用红外线发射器向电视和其他设备发送信号。在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 。
谢谢。