Saturday, February 26, 2011

Wireless on the OPLay HD2

Bah..Just after I struggled and figured out how to configure a wireless dongle for my OPLay HD2, Asus comes out with a firmware that makes this a snap.

So you only need to do two things now:

1) Buy a wifi dongle. Choose an Asus one just to be safe.
2) Download the firmware zip from
ftp://ftp.asus.com.tw/pub/ASUS/Digital_Media_Player/HD2/firmware/ and follow the install instructions mentioned in the PDF inside.

Thats it.

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!

Sunday, October 31, 2010

The D Programming Language Rocks

Right now I am parsing my way through Andrei Alexandrescu's 'The D programming language' and so far I am loving everything in it. This language hits a real sweet spot for a developer - tight, native executables, good integration with C libraries, a nice functional programming paradigm, generics support (*real* generics not the pseduo crap that we have in Java), support for modular programming, the no-shared-data way of doing concurrency and all the above in a clean, readable even elegant syntax.

Wow - just simply wow. Of course, I need to do some *real* programming like writing some usable frameworks/apps/libraries in D before jumping the gun, but I do have to say that it looks *really* good. Considering that my beloved Java is sucky and stale nowadays and its providence in Oracular hands is murky at best, D appears to offer a clean and powerful alternative.

VIM D editing support:

Friday, May 28, 2010

Simple One Line Http Server

  • Get Python 3.1.x.
  • Navigate to the directory that you wish to server.
  • Issue this command python -m http.server
  • Enjoy

Friday, June 12, 2009

Space Opera by David Drake

I have always been a science-fiction/fantasy addict - it's a wonderful 'escapist' way to leave the real world behind and literally 'live' in another's imagination.


Having always been an "HonorVerse" fan, I only recently commenced the "RCN series" by David Drake. It's highly enjoyable space-opera - not anything that makes a deep impact in the SF/fantasy world, but just plain fun nevertheless.
The books describe the adventures of Lt Leary (who gets promoted over time) and his signals officer Adele Mundy. Adele Mundy, who is described in the books (by her peers) as the best 'information specialist' in the galaxy, is actually a hacker - and she has to be the best 'space-age' hacker that I have seen described in any space-opera fantasy. Not only that - she is an expert shot with her pistol. (And yeah - I have a small crush on her)
I can't help admit that I devoured all the books in the series within a fortnight and now need to wait for a l-o-o-ng time till Mr Drake comes up with something new.