unable to execute ioctl in android oreo

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

unable to execute ioctl in android oreo

3,073 Views
susangracerapak
Contributor II

Hi,

I am trying to execute a command using system call in Android oreo,in wifi_hal_common.cpp file, inside "int wifi_load_driver() {" function

system("./onebox_util rpine0 enable_protocol 1");

or

execl("/system/bin/onebox_util","onebox_util","rpine0","enable_protocol", "1",NULL);

both are not working.Please see the following logcat.

My module .ko's got inserted while booting, but I am unable to enable my custom wifi protocol.

Please anyone help me.

The logcat is:

01-01 00:02:05.490  1199  1199 I sh      : type=1400 audit(0.0:37): avc: denied { execute_no_trans } for path="/system/bin/onebox_util" dev="mmcblk2p3" ino=304 scontext=u:r:hal_wifi_default:s0 tcontext=u1
01-01 00:02:06.510   778   778 E android.hardware.wifi@1.0-service: Redpine in wifi_load_driver enabling protocol execl: Success
init: Service 'wifi_hal_legacy' (pid 778) exited with status 2
init: Sending signal 9 to service 'wifi_hal_legacy' (pid 778) process group...
01-01 00:02:06.541   402   461 E binder: release 778:778 transaction 30887 in, still active
HalDeviceManager: IWifi HAL servibinder: send failed reply for transaction 30887 to 402:474
ce died! Have a listener for it .init: kill(-778, 9) failed: No such process
.. cookie=0
01-01 00:02:06.541  init: Successfully killed process cgroup uid 1010 pid 778 in 6ms
 402   474 E HalDeviceManager: executeChipReconfiguration exceptiinit: starting service 'wifi_hal_legacy'...
on: android.os.RemoteException: HwBinder Error: (-32)
01-01 00:0init: property_set("ro.boottime.wifi_hal_legacy", "121656472346") failed: property already set
2:06.542   402   474 E HalDeviceManager: stopWifi exception: android.os.RemoteException: HwBinder Error: (-32)
01-01 00:02:06.542   402   474 E WifiNative-wlan0: Failed to start HAL for client mode
01-01 00:02:06.543   402   402 E WifiController: WifiControllerWifi turn on failed
01-01 00:02:06.545   402   474 W HalDeviceManager: stopWifi called but mWifi is null!?
01-01 00:02:06.545   402   474 I WifiVendorHal: Vendor Hal stopped
01-01 00:02:06.545   402   474 D WificondControl: tearing down interfaces in wificond
01-01 00:02:06.560   402   474 W HalDeviceManager: startWifi called but mWifi is null!?
01-01 00:02:06.560   402   474 W HalDeviceManager: stopWifi called but mWifi is null!?
01-01 00:02:06.560   402   474 E WifiNative-wlan0: Failed to start HAL for client mode
01-01 00:02:06.561   402   402 E WifiController: WifiControllerWifi turn on failed
01-01 00:02:06.570   402   474 W HalDeviceManager: stopWifi called but mWifi is null!?
01-01 00:02:06.570   402   474 I WifiVendorHal: Vendor Hal stopped

Regards

Susan

0 Kudos
Reply
3 Replies

1,978 Views
susangracerapak
Contributor II

Please anyone help me to fix this

Regards

Susan

0 Kudos
Reply

1,978 Views
diegoadrian
NXP Employee
NXP Employee

Hello,

Unfortunately, we only support our BSP as is. However, the below webpage can help in your question.

How do you create a loadable kernel module for Android? - Stack Overflow 

Best Regards,

Diego.

0 Kudos
Reply

1,978 Views
susangracerapak
Contributor II

Hi Diego,

Thanks for the information.

But my issue is different, I have disabled the BCM Wifi modules which comes with the android BSP and loaded my Custom driver modules successfully,then I am using custom compiled binary[ onebox_util ]for enabling Wifi protocol but, I am unable to execute that binary from .cpp file.

The same "onebox_util" is working when I am trying to execute from android terminal.But I want to excute this utility when I turn "ON" Wi-Fi from GUI.

My Code in "wifi_hal_common.cpp" file is :

FILE *fp;

const char *wifi_get_fw_path(int fw_type) {
        switch (fw_type) {
                case WIFI_GET_FW_PATH_STA:
                        PLOG(ERROR) << "****************In WIFI_GET_FW_PATH_STA*********";
                        fp=fopen("/system/lib/onebox_util rpine0 enable_protocol 1","r");
                        if(fp==NULL)
                        {
                        PLOG(ERROR) << "could not open onebox_util...fp is NULL";
                        }
                        fclose(fp);
                        PLOG(ERROR) << "Trying to execute  the same with system call";
                        system("onebox_util rpine0 enable_protocol 1");
                        return NULL;

                case WIFI_GET_FW_PATH_AP:
                        return WIFI_DRIVER_FW_PATH_AP;
                            case WIFI_GET_FW_PATH_P2P:
                        return WIFI_GET_FW_PATH_P2P;   
}
return NULL;
}

When I am trying to "ON" Wi-Fi from GUI, I am getting the following prints:

android.hardware.wifi@1.0-service: Rtype=1400 audit(280.710:41): avc: denied { execute_no_trans } for pid=1552 comm="sh" path="/system/bin/onebox_util" dev="mmcblk2p3"
01-01 00:05:01.531   280   280 I android.hardware.wifi@1.0-service: Wifi HAL started
01-01 00:05:01.540   280   280 E android.hardware.wifi@1.0-service: ****************In WIFI_GET_FW_PATH_STA*********: No such device
01-01 00:05:01.540   280   280 E android.hardware.wifi@1.0-service: could not open onebox_util...fp is NULL: No such file or directory
01-01 00:05:01.540   280   280 E android.hardware.wifi@1.0-service: Trying to execute the same with system call: No such file or directory

and in BoardConfig.mk I have given the following:

BOARD_KERNEL_CMDLINE := console=ttymxc0,115200 init=/init video=mxcfb0:dev=hdmi,fbpix=RGB32,bpp=32 video=mxcfb1:off video=mxcfb2:off video=mxcfb3:off vmalloc=128M androidboot.console=ttymxc0 consoleblank=0 androidboot.hardware=freescale cma=448M galcore.contiguousSize=33554432 enforcing=0 androidboot.selinux=permissive androidboot.dm_verity=disable

Do you any idea about this?

Regards

Susan

0 Kudos
Reply