Search code examples
androidlinuxandroid-5.0-lollipopandroid-4.4-kitkatinfrared

Permission denied even with 777


So I'm developing an android app. It uses IR blaster to send signals to TVs and other stuff. It worked fine on CyanogenMod 11(Android 4.4.4) but after updating to CyanogenMod 12(Android 5.0) it stopped working. App is assessing these files: /dev/ttyHSL2 and /sys/devices/platform/ir_remote_control/enable . Normally their permissions are ok, but after updating they are "ok" but not ok :/ :

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

So I've tried to fix them:

su -c "chmod 222 /sys/devices/platform/ir_remote_control/enable"
su -c "chmod 666 /dev/ttyHSL2"

Still same errors. Then I've tried this:

su -c "chmod 777 /sys/devices/platform/ir_remote_control/enable"
su -c "chmod 777 /dev/ttyHSL2"

Still nothing... I've checked permissions and they were ok:

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

So if there are any ideas please help me. My app is open source so here is source code if you need it https://github.com/sssemil/android_packages_apps_IRRemote .

Thanks.


Solution

  • So, to fix it type: su -c "setenforce 0"