Sunday, January 30, 2011

Making Wireless work on the Asus O!Play HD2

WARNING: There might be side effects to the below that i am yet to discover.

The Asus OPLay HD2 runs Linux! (2.6.12 kernel/MIPS). Woot!

Power on your oPlay, get a RJ45 cable and connect the HD2 to your wireless router. You can even take the HDMI cable and connect it to your computer monitor (if you have an HDMI port), but this isn't really necessary.

Figure out the IP Address of OPlay from the setup. Now open up a command shell in your OS and telnet to this IP address.


$ telnet 192.168.10.101
Trying 192.168.10.101...
Connected to 192.168.10.101.
Escape character is '^]'.
OPLAYF9 login: root
warning: cannot change to home directory


BusyBox v1.1.3 (2010.06.24-09:31+0000) Built-in shell (ash)
Enter 'help' for a list of built-in commands.

Now, plug in your wireless dongle. (I use an Asus N10). If you have your HDMI cable connected to your TV/comp monitor, it should say 'wifi-plugin detected'. But you can check this using 'ifconfig'


/ # ifconfig
.........

wlan0 Link encap:Ethernet HWaddr 00:26:18:A1:57:4B
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:10 overruns:0 frame:0
TX packets:28 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:1176 (1.1 KiB)
..........

Ifconfig must show a wireless interface or there is no point in progressing further!

Now we need to make a wireless configuration file that provides details of our SSID, authentication, etc. The tool that reads this on Linux is called wpa_supplicant.

Now, I first take a look at whether I have some free space to put this file anywhere. (I haven't attached a USB/internal hard disk to my OPlay yet so that option is ruled out)


/usr/local/etc # df -h
Filesystem Size Used Available Use% Mounted on
/dev/root 46.9M 46.9M 0 100% /
/dev/mtdblock/2 60.0M 2.6M 57.4M 4% /usr/local/etc
/dev/rd/0 40.0k 40.0k 0 100% /mnt/rd

Ok, so there is space available under '/usr/local/etc'. Teeny 'vi' is available everywhere, so I use that

# vi /usr/local/etc/wpa.conf

and fill in the contents below. This is just an example, study the wpa_supplicant manual and adjust the configuration according to your specific authentication method, etc.

network={
ssid="mySSID"
scan_ssid=1
key_mgmt=WPA-PSK
psk="myPassKey"
}

Let check whether the configuration is valid. Launch wpa_supplicant in debug model with this configuration in the foreground.

# wpa_supplicant -c/usr/local/etc/wpa.conf -iwlan0 -d
Initializing interface 'wlan0' conf '/usr/local/etc/wpa.conf' driver 'default' ctrl_interface 'N/A'
bridge 'N/A'
....loads of stuff
CTRL-EVENT-CONNECTED - Connection to 00:14:bf:93:84:80 completed (auth) [id=0 id_str=]
...
EAPOL authentication completed successfully
...

Ok, let us CTRL-C and return to the command prompt. Let us ensure that that 'wpa_supplicant' is started at boot time. The way I suggest here isn't very clean but I can't be bothered to think of a better approach now.

Open up '/usr/local/etc/rcS', look for this line at the end

/usr/sbin/initsys

Change it to

/usr/sbin/initsys &


And now adds line to start wpa_supplicant and the dhcp client (to get your wireless IP) after sleeping for 12 seconds. Modify the sleep value to whatever you think is appropriate - I found that a value of less than 12 seconds caused problems for me.



/usr/sbin/initsys &
sleep 12
/usr/local/bin/wpa_supplicant -c/usr/local/etc/wpa.conf -iwlan0 -P /var/run/wpa_supplicant.pid -B
sleep 6
/sbin/udhcpc -p /var/lock/udhcpc_wlan0.pid -iwlan0 -t15 -b -s /etc/udhcpc.script



Note: If someone can suggest a better method, please leave a comment. I am really uncomfortable about launching initsys in the background!

Perform a reboot.

/usr/local/etc # reboot
/usr/local/etc # Connection closed by foreign host.

Telnet in again and check that the processes are really running

/ # ps | grep wpa
476 root 796 S /usr/local/bin/wpa_supplicant -c/usr/local/etc/wpa.co
1168 root 304 S grep wpa
/ # ps | grep ud
433 root 368 S /sbin/udhcpc -p /var/lock/udhcpc_eth0.pid -t 15 -b -s
731 root 368 S /sbin/udhcpc -p /var/lock/udhcpc_wlan0.pid -iwlan0 -t
1170 root 304 S grep ud

Check that ip assignment to wlan0 has occurred correctly.

/ # ifconfig wlan0
wlan0 Link encap:Ethernet HWaddr 00:26:18:A1:57:4B
inet addr:192.168.10.103 Bcast:192.168.10.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:685 errors:0 dropped:194 overruns:0 frame:0
TX packets:52 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:97537 (95.2 KiB) TX bytes:7774 (7.5 KiB)


Check that you can ping the inet address assigned to wlan0 from another comp in your home network

$ ping 192.168.10.103
PING 192.168.10.103 (192.168.10.103): 56 data bytes
64 bytes from 192.168.10.103: icmp_seq=0 ttl=64 time=1 ms
...


Finally, disconnect your RJ45 cable, power off/on and check that you are able to still telnet into O!Play. See the wireless client list in your router to figure out the IP. (since the OPLay UI only shows wired IP's)

Now I can carry my O!Play away from my router and towards my TV! Woot!

12 comments:

Lee said...
This comment has been removed by the author.
Lee said...

It's so surprising me that you can play O!Play HD2 on this way.
I bought it two weeks ago in Taiwan. ASUS said wifi function is not supported player sold in Taiwan.
1) I would like to know if your dongle USB-N10 is bundled with HD2, or buy it yourself?
2)Once anything wrong after the change in telnet, can firmware reload back to original?
Thanks for your information!
(I played Linux 10 years ago, and not very familiar now.)

-Winson

Tarun Elankath said...

HI Winson,

Sorry.just saw your comment today.

Actually my whole post is a waste since Asus now supports a build that comes with wireless configuration UI. Check out the asus site.
1) I had to buy the N10 dongle..it isn't expensive.
2) Don't bother with my steps, just use the latest OPlay Hd2 firmware.

Lee said...

The wifi function was equipped since firmware v1.12. But according to ASUS official response, only bundled selling would support it.(The bundle dongle seems like USB-N10). I had just ordered it from website. Hope it can use on my HD2. Thanks for all your sharing~~~

Lee said...

I got the dongle and it works on my HD2. Here I have two requests but it seems not support by ASUS's fireware:
1) I don't want to broadcast SSID.
2) I'd like to fix IP for HD2 but not DHCP.
So, it seems your manner(config it in Linux itself) would fulfill above requests. I'm appreciated if you have more information for it! Thanks!
-Winson

Marton said...

Do you know how to set an static IP address for Wifi?

Tarun Elankath said...

Setting a static ip address is just a matter of using ifconfig properly. Infact, it is simpler since you don't need to bother setting up the dhcp client, etc

It can be as simple as:

ifconfig wlan0 192.168.1.5 netmask 255.255.255.0 up

Lee said...

It works manually but not for automation. I tried to put it in /usr/local/etc/rcS, but it seems would be overwrote by ASUS firmware~~~:(

Anonymous said...

hi tarun,

this is mani from Delhi. Just bought o!play HD2 while I am able to connect it with my LCD thru HDMI cable but after connecting it to my Acer Laptop thru HDMI only...i don't see HD2 or home screen on laptop. My screen setting is 1200x800. Pls lemme know if u got any clue.
Thnx
Mani
Email: krmanish97@yahoo.com

mache said...

Can anyone share wpa_suplicat binary ? I have asus o play mini and i've managed to rebuild kernel 2.6.12 with 8129_cu partially working ( i need to test tomorow the oficial ENORE driver). i cannot manage to build wpa_wuplicant 1.0.

Anonymous said...

Hi Tarun,

i found Linux O!PLAY_HD2_8C 2.6.12.6-VENUS on my box...i plugged the Asus USB-N10 Wireless dongle...

ifconfig:


wlan0 Link encap:Ethernet HWaddr C8:60:00:5E:52:53
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

i have configured my wpa file:


network={
ssid="FULCRUM-NET"
scan_ssid=1
key_mgmt=WPA-PSK
psk="password"

i gave the command:

wpa_supplicant -c/usr/local/etc/wpa.conf -iwlan0 -d

NO CONNECT!

the router is configured in this way:

SSID: FULCRUM-NET
Security Mode: WPA-PSK
Encryption: AES

what is wrong?

thanx in advance

Massimo

Anonymous said...

[solved]

after the upgrade to 2.4 version is it possible to configure WLAN settings under system GUI...it works :)

bye

massimo