[SOLVED :)] Wifi card on RPi2

I've inserted a Ralink WiFi dongle into an RPi2.

lsusb lists it as 148f:5370 - an RT5379 Wireless adapter. How do I enable it? There is no /etc/config/wireless which I am supposed to edit according to https://wiki.openwrt.org/doc/uci/wireless.

Do i just need to create the file and include the following lines?

config 'wifi-device' 'wl0'
        option 'type'    'broadcom'
        option 'channel' '6'

Is the file /etc/config/wireless created if you run wifi config over ssh or serial console?

If not your pi is missing some packages...

I assume you need at least kmod-rt2x00-usb or kmod-rt2800-usb and wpad.
Install this with all dependencies with:

opkg update
opkg install kmod-rt2x00-usb kmod-rt2800-usb wpad

Then try again with wifi config.

if that still don't work also install

opkg kmod-rt2800-usb

run wifi

Thanks for the suggestion, but... get Cannot install package.

Collected errors Cannot satisfy dependencies and then six references to
kernel (= 4.9.111.1-7809...................) *

You are using a snapshot version with a older kernel version and the snapshot kmod packages are for a newer kernel version.

If your kernel is not that old, you could try to install with opkg --force-depends install ... but you should consider to update your snapshot to latest version or use a stable release.

1 Like

Can I build a stable release using menuconfig? It was the first I had tried it so wasn't sure what to look for.

Yes... I assumed that you used a prebuild image... You could also build from master and include the mentioned packages with make menuconfig...

If you build from a stable tagged version you have to build with the same kernel config, else you will also see the dependency error because of kernel config hash mismatch.

1 Like

I've now installed 17.01.04 - There was no reference to it from https://wiki.openwrt.org/toh/raspberry_pi_foundation/raspberry_pi
so didn't know where to find a newer version initially.
After installing kmod-rt2800-usb, a wireless file appears. I set 'disabled' to 0 and reload the network but see no wireless interface when running ifconfig, even after a reboot.

What have I missed out?

Are you seeing two sections in wireless config?

Please post the initial wireless config and the output of iw list.

wireless:-

config wifi-device 'radio0'
	option type 'mac80211'
	option channel '11'
	option hwmode '11g'
	option path 'platform/soc/3f980000.usb/usb1/1-1/1-1.4/1-1.4:1.0'
	option htmode 'HT20'
	option disabled '0'

config wifi-iface 'default_radio0'
	option device 'radio0'
	option network 'lan'
	option mode 'ap'
	option ssid 'LEDE'
	option encryption 'none'

iw list:-

Wiphy phy0
	max # scan SSIDs: 4
	max scan IEs length: 2257 bytes
	max # sched scan SSIDs: 0
	max # match sets: 0
	max # scan plans: 1
	max scan plan interval: -1
	max scan plan iterations: 0
	Retry short long limit: 2
	Coverage class: 0 (up to 0m)
	Available Antennas: TX 0 RX 0
	Supported interface modes:
		 * IBSS
		 * managed
		 * AP
		 * AP/VLAN
		 * monitor
		 * mesh point
	Band 1:
		Capabilities: 0x17e
			HT20/HT40
			SM Power Save disabled
			RX Greenfield
			RX HT20 SGI
			RX HT40 SGI
			RX STBC 1-stream
			Max AMSDU length: 3839 bytes
			No DSSS/CCK HT40
		Maximum RX AMPDU length 32767 bytes (exponent: 0x002)
		Minimum RX AMPDU time spacing: 2 usec (0x04)
		HT TX/RX MCS rate indexes supported: 0-7, 32
		Frequencies:
			* 2412 MHz [1] (20.0 dBm)
			* 2417 MHz [2] (20.0 dBm)
			* 2422 MHz [3] (20.0 dBm)
			* 2427 MHz [4] (20.0 dBm)
			* 2432 MHz [5] (20.0 dBm)
			* 2437 MHz [6] (20.0 dBm)
			* 2442 MHz [7] (20.0 dBm)
			* 2447 MHz [8] (20.0 dBm)
			* 2452 MHz [9] (20.0 dBm)
			* 2457 MHz [10] (20.0 dBm)
			* 2462 MHz [11] (20.0 dBm)
			* 2467 MHz [12] (20.0 dBm) (no IR)
			* 2472 MHz [13] (20.0 dBm) (no IR)
			* 2484 MHz [14] (20.0 dBm) (no IR)
	valid interface combinations:
		 * #{ managed, AP, mesh point } <= 8,
		   total <= 8, #channels <= 1
	HT Capability overrides:
		 * MCS: ff ff ff ff ff ff ff ff ff ff
		 * maximum A-MSDU length
		 * supported channel width
		 * short GI for 40 MHz
		 * max A-MPDU length exponent
		 * min MPDU start spacing

Looks good...
Do you see any output with logread if you execute wifi down or wifi up?
And if you do wifi up, is the file /tmp/run/hostapd-phy0.conf created?

Looking through logread I see:-

daemon.notice netifd: radio0 (396): command failed: Not supported (-95)
daemon.notice netifd: radio0 (396): ./mac80211.sh: eval: line 1: /usr/sbin/hostapd: not found

/tmp/run/hostapd-phy0.conf contains:-

driver=nl80211
logger_syslog=127
logger_syslog_level=2
logger_stdout=127
logger_stdout_level=2
hw_mode=g
beacon_int=100
channel=11

ieee80211n=1
ht_coex=0
ht_capab=[SHORT-GI-20][SHORT-GI-40][RX-STBC1]

interface=wlan0
ctrl_interface=/var/run/hostapd
disassoc_low_ack=1
preamble=1
wmm_enabled=1
ignore_broadcast_ssid=0
uapsd_advertisement_enabled=1
auth_algs=1
wpa=0
ssid=RPi
bssid=00:0f:13:38:1b:10

My Android Wifi Analyzer does not see the SSID RPi. and ifconfig does not show wlan0

install hostapd with opkg install hostapd
Thought this was installed with wpad.

1 Like

It looks like you still lack the hostapd program itself. Generally wpad or wpad-mini is installed to supply /usr/sbin/hostapd. Wpad is a dual purpose binary that can be run as an AP (hostapd) or a client (wpa-supplicant).

Note that hostapd-common is just the script that creates the hostapd config. It isn't hostapd itself.

root@OpenWrt:~# opkg files wpad-mini
Package wpad-mini (2018-04-09-fa617ee6-5) is installed on root and has the following files:
/usr/sbin/wpad
/usr/sbin/hostapd
/usr/sbin/wpa_supplicant

hostapd and wpa_supplicant are links to wpad. I'm not sure what the purpose of the various "hostapd" packages are. wpad contains the full hostapd functionality.

1 Like

Is that better? :grinning:

Just tried installing wpad and hostapd - get unknown package...

After running opkg update (although it has already been run today) I was able to install hostapd and after running wifi up, ifconfig now shows wlan0! So must be getting close now.

The opkg list of packages (downloaded by opkg update) is stored on the RAM disk, it will be erased by a reboot.

1 Like

Thanks for that. I didn't know.

Thanks to all the help I've received here I know Wifi card active, I see wlan0 and the associated SSID, but I can't connect to it.. Not sure if I have ommitted anything or got the configuration wrong. My RPi is not running DHCP, it gets its IP address from pfSense which is the internet gateway.

What else do I need to do to get Internet access on my phone or tablet via my OpenWrt RPi?