How to use "modprobe" command in app?

I want to modprobe mac80211 by using app but it was error.

    system("/home/root/wf200.sh &");
	sleep(2);
    system("ifconfig wlan0 up");
Mar 17 10:36:54 swi-mdm9x28-wp user.err Legato: =ERR= | NAD[2034] | /home/root/wf200.sh: 
Mar 17 10:36:54 swi-mdm9x28-wp user.err Legato: =ERR= | NAD[2034] | line 1: 
Mar 17 10:36:54 swi-mdm9x28-wp user.err Legato: =ERR= | NAD[2034] | modprobe: not found
Mar 17 10:36:54 swi-mdm9x28-wp user.err Legato: =ERR= | NAD[2034] | 
Mar 17 10:36:54 swi-mdm9x28-wp user.err Legato: =ERR= | NAD[2034] | /home/root/wf200.sh: 
Mar 17 10:36:54 swi-mdm9x28-wp user.err Legato: =ERR= | NAD[2034] | line 2: 
Mar 17 10:36:54 swi-mdm9x28-wp user.err Legato: =ERR= | NAD[2034] | insmod: not found
Mar 17 10:36:54 swi-mdm9x28-wp user.err Legato: =ERR= | NAD[2034] | 
Mar 17 10:36:54 swi-mdm9x28-wp user.err Legato: =ERR= | NAD[2034] | ash: write error: Device or resource busy
Mar 17 10:36:54 swi-mdm9x28-wp user.err Legato: =ERR= | NAD[2034] | ash: write error: Device or resource busy
Mar 17 10:36:56 swi-mdm9x28-wp user.err Legato: =ERR= | NAD[2034] | sh: 
Mar 17 10:36:56 swi-mdm9x28-wp user.err Legato: =ERR= | NAD[2034] | ifconfig: not found
Mar 17 10:36:56 swi-mdm9x28-wp user.err Legato: =ERR= | NAD[2034] | 

How to use command in the app c file?

how abut you change your wf200.sh to use absolute path like /sbin/modprobe?

I had wrote it right this.

#!/bin/sh
modprobe mac80211
insmod wfx.ko
echo 13 > /sys/class/gpio/export

how about changing it to " /sbin/modprobe mac80211" and re-run the legato app?

got this:

I have added this line and got this

PATH=/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin;

ok, it is better, at least there is no modprobe problem

1 Like