mediaserver (Sound Trigger HAL) fails on ioctl call and it returns "opeartion not permitted" or "-EPERM"

84 views
Skip to first unread message

NY

unread,
Oct 26, 2015, 6:35:11 PM10/26/15
to android-porting

mediaserver (Sound Trigger HAL) fails on ioctl call and it returns "opeartion not permitted" or "-EPERM"

Declared these two variables inside sound_trigger_hw.c file
struct cmd{
int *buf;
size_t size;
};
#define READ_IOCTL = _IOR('o', 0x30, struct cmd)

and did open device "/dev/eac" using below call inside sound_trigger_hw.c file

fd = open("/dev/eac", O_RDWR);

after successfully it opens I  made a call to ioctl like below
    if (fd < 0) {
        ALOGE("Error opening eac device:%d",errno );
        return ret;
    }
    else{
        struct cmd cmd;
        int ret = 0;
        cmd.size = 4096;
        cmd.buf = (int*)malloc(inrt*4096);
        ret = ioctl(fd, READ_IOCTL, &cmd);
        if (ret < 0) {
            ALOGV("IOCTL failed with code %d,errno:%d,errorinfo:%s", ret,errno,strerror(errno));
            return ret;
        }
    }

And here is failing error message.
"IOCTL failed with code -1,errno:1, Operation not permitted"

As per my understand ioctl call is going to goldfish_audio.c file in kernel as I am running this code on Marshmallo emulator.
and I guess this is failing due to sepolicy permission in mediaserver.te file ,not sure exactly what I need to make the change in mediaserver.te to access ioctl calls.
or may be somewhere in policy file which I need to take care of this to make the succesful calls to ioctl with read and write permissions.

Please help me on this and let me know your suggestion on this




Reply all
Reply to author
Forward
0 new messages