3

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.

gre_gor
  • 6,669
  • 9
  • 47
  • 52
sssemil
  • 279
  • 6
  • 15
  • 3
    Maybe related to SE Linux (https://source.android.com/devices/tech/security/selinux/) permissions? – j.holetzeck May 09 '15 at 19:01
  • With a few legacy exceptions, Android isn't designed with the idea of apps directly accessing hardware resources - rather, a system daemon does that and apps make requests to it via Android-level IPC, often after verification of an Android-level permission. – Chris Stratton May 09 '15 at 19:37
  • Hmm.. Looks like j.holetzeck is right. Setting SELinux to Permissive helped. – sssemil May 10 '15 at 10:42

1 Answers1

2

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

sssemil
  • 279
  • 6
  • 15