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.
Saturday, February 26, 2011
Wireless on the OPLay HD2
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.
Saturday, September 13, 2008
Airtel India blocks IRC Undernet
The Undernet group of servers in the IRC (Internet Relay Chat) system, (us.undernet.org/eu.undernet.org) has been inaccessible since the last week of August for Airtel India users. Despite many complaints by many users to Airtel India over the last 20 days, they are still in denial mode and refuse to acknowledge a problem.
For the uninitiated, The Undernet is one of the oldest and largest realtime chat networks in the world, with approximately 19 servers connecting over 35 countries and serving more than 1,000,000 people weekly. See http://www.undernet.org/ for further information.
The problem is faced by all Airtel ISP users in India across all Indian cities - Delhi, Bangalore, Allahabad, etc.
Since the undernet group of servers generally has a community of vocal and gifted programmers/hackers, it is possible that Airtel has decided to 'silently' block this and claim otherwise. If so, this goes against our right to free speech and expression: http://en.wikipedia.org/wiki/Fundamental_Rights_in_India
If you are an Airtel user, please register a complaint by e-mailing Airtel at your city's customer care address, the list of which are available from:
http://www.airtel.in/wps/wcm/connect/airtel.in/Airtel.In/Home/ForYou/Broadband+Internet/Reach+Airtel#
For example, the complaint e-mail for Bangalore is: care.ncr@airtel.in
Please note - that page DOES NOT WORK in firefox (or any other browser apart from Internet Explorer) - another minus mark against Airtel.
Users have a on-going discussion page at the Undernet forums http://forum.undernet.org/viewtopic.php?f=2&t=9536&st=0&sk=t&sd=a , but are unsure on what to do.
I am a 2Mbps, un-limited download Airtel user. For India, which has poor broadband facilities, that falls into the top segment of broad-band users and I pay a bucket of money for the service.
After Airtel's well known policy of padding your bills with ringtone costs you never use - (and calling them up to fix this never works), this is personally pretty much the limit for me.
Saturday, June 28, 2008
Can't extend ByteBuffer
java.nio.ByteBuffer is not extensible and this really sucks badly. I didn't realize that till today when I thought to write a custom ByteBuffer implementation and then realized that all the constructors had only package visibility.
The thing is that there are many good reasons why you would want a custom implementation of ByteBuffer . Maybe you want to proxy over another ByteBuffer for example; have an optimized view over a larger ByteBuffer to reduce data copying.
It seems that I was not the only one to feel this way. Check out http://forum.java.sun.com/thread.jspa?threadID=693259&messageID=4028590
It appears that not just a few people, but also whole frameworks like Apache MINA have gone ahead and constructed their own ByteBuffer replacements. Check out http://mina.apache.org/report/1.1/apidocs/org/apache/mina/common/ByteBuffer.html which is extensible.
Saturday, May 31, 2008
Access Windows Registry using 'pure' Java
(rehash of my old post since all those wonderful blog post drafts I was planning to publish are unfortunately out-dated or irrelevant)
One can use the private code of Sun's Preferences API to access values of type REG_SZ in the Windows Registry. Stupid hack. Maybe I should make a library out of this. I have used this soooo many times.
java.util.prefs.WindowsPreferences is the concrete implementation of AbstractPreferences in the Windows platform. This class provides methods like WindowsRegQueryValueEx, etc. Using Reflection, one can use the methods in this class to query string values under HKEY_LOCAL_MACHINE and HKEY_CURRENT_USERGiven below is a code-snippet that demonstrates how to get the
ProxyServer setting on Windows (this is what IE uses/sets) and the Internet Explorer version
import java.lang.reflect.Method;
import java.util.prefs.Preferences;
public class JavaRegistryHack {
private static final int HKEY_CURRENT_USER = 0x80000001;
private static final int KEY_QUERY_VALUE = 1;
private static final int KEY_SET_VALUE = 2;
private static final int KEY_READ = 0x20019;
public static void main(String args[]) {
final Preferences userRoot = Preferences.userRoot();
final Preferences systemRoot = Preferences.systemRoot();
final Class clz = userRoot.getClass();
try {
final Method openKey = clz.getDeclaredMethod("openKey",
byte[].class, int.class, int.class);
openKey.setAccessible(true);
final Method closeKey = clz.getDeclaredMethod("closeKey",
int.class);
closeKey.setAccessible(true);
final Method winRegQueryValue = clz.getDeclaredMethod(
"WindowsRegQueryValueEx", int.class, byte[].class);
winRegQueryValue.setAccessible(true);
final Method winRegEnumValue = clz.getDeclaredMethod(
"WindowsRegEnumValue1", int.class, int.class, int.class);
winRegEnumValue.setAccessible(true);
final Method winRegQueryInfo = clz.getDeclaredMethod(
"WindowsRegQueryInfoKey1", int.class);
winRegQueryInfo.setAccessible(true);
byte[] valb = null;
String vals = null;
String key = null;
Integer handle = -1;
//Query Internet Settings for Proxy
key = "Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings";
handle = (Integer) openKey.invoke(userRoot, toCstr(key), KEY_READ, KEY_READ);
valb = (byte[]) winRegQueryValue.invoke(userRoot, handle.intValue(),
toCstr("ProxyServer"));
vals = (valb != null ? new String(valb).trim() : null);
System.out.println("Proxy Server = " + vals);
closeKey.invoke(Preferences.userRoot(), handle);
// Query for IE version
key = "SOFTWARE\\Microsoft\\Internet Explorer";
handle = (Integer) openKey.invoke(systemRoot, toCstr(key), KEY_READ, KEY_READ);
valb = (byte[]) winRegQueryValue.invoke(systemRoot, handle, toCstr("Version"));
vals = (valb != null ? new String(valb).trim() : null);
System.out.println("Internet Explorer Version = " + vals);
closeKey.invoke(Preferences.systemRoot(), handle);
} catch (Exception e) {
e.printStackTrace();
}
}
private static byte[] toCstr(String str) {
byte[] result = new byte[str.length() + 1];
for (int i = 0; i < str.length(); i++) {
result[i] = (byte) str.charAt(i);
}
result[str.length()] = 0;
return result;
}
Google Collections now in Maven repository
Google Collections has now been mavenized, or to be more precise - the artifacts are present in the maven repository. Check out Maven Repo1 and the issue that reports this.
Just add the below to your <project&gt;.pom and you are good to go.
<dependency>
<groupId>com.google.code.google-collections</groupId>
<artifactId>google-collect</artifactId>
<version>snapshot-20080321</version>
</dependency>
(Google collection's is like the Apache commons collections but generified)
Friday, January 25, 2008
My first Ruby Program - the Icon Indexer
Well.. I work a lot on eclipse and I always wanted to get the complete eclipse icon set from my eclipse directory (for my eclipse rich client applications) and have a nice index.html file to view the same. Decided to spin a ruby program to do the job.
(Yeah...I do know about ISharedImages.. but that doesn't give everything)
require 'find'
class IconIndexer
def index(base_dir)
idx_path = base_dir + '\index.html'
idxh = File.new(idx_path, "w")
puts "Created index file at " + File.expand_path(idx_path)
puts "Scanning image files (.gif/.png) from #{base_dir} ..."
idxh.puts <<-EOS
<html>
<head>
<title>Icon Index generated for #{base_dir} on #{Date.today()}</title>
</head>
<body>
<table>
EOS
cnt = 0;
ncols = 3;
icon_size = 3 * 1024;
# Scan base_dir get all gifs/png's less than 'icon_size' kb and
# create index html consisting of 'ncol' sized table with these images.
# ofcouse this is a dumb program since it doesn't take img dimentions into account
# but nvm.
Find.find(base_dir) do |path|
if File.extname(path) =~ /(.gif|.png)/ and File.size(path) < icon_size
if cnt % ncols == 0
idxh.puts "<tr>\n"
end
img_path = File.expand_path(path);
html = "<td><a href='#{img_path}'><img border='0' src='#{img_path}'/></a></td>"
cnt+=1
idxh.puts(html)
if cnt % ncols == 0
idxh.puts "</tr>\n"
end
end
end
idxh.puts <<-EOS
</table>
</body>
</html>
EOS
end
end
indexer = IconIndexer.new()
if ARGV[0]
indexer.index(ARGV[0])
else
script_name = File.basename(__FILE__);
puts "Usage: #{script_name} <search_dir>"
end
Thursday, November 8, 2007
Samba in Java
I have known about this great open-source library for a long time and have utilized it in just about every java application deployed on a windows corporate intranet - and I am always surprised that so few people know about it. I am referring to the JCIFS library that implements the CIFS/SMB networking protocol in 100% Java.
Windows (NTLM) authentication against a domain controller is as simple as specifying a servlet filter and configuring its properties. ( The below is shamefully :-) copied from the FAQ )
<filter>
<filter-name>NtlmHttpFilter</filter-name>
<filter-class>jcifs.http.NtlmHttpFilter</filter-class>
<init-param>
<param-name>jcifs.http.domainController</param-name>
<param-value>192.168.2.15</param-value>
</init-param>
<init-param>
<param-name>jcifs.smb.client.logonShare</param-name>
<param-value>JCIFSACL</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>NtlmHttpFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
Arbitrary java clients (other than webapps) could use something similar to:
UniAddress mydomaincontroller = UniAddress.getByName( "192.168.1.15" );
NtlmPasswordAuthentication mycreds = new NtlmPasswordAuthentication( "ntdom", "user", "pass" );
try {
SmbSession.logon( mydomaincontoller, mycreds );
// SUCCESS
return true;
} catch( SmbAuthException sae ) {
// AUTHENTICATION FAILURE
return false;
} catch( SmbException se ) {
// NETWORK PROBLEMS?
se.printStackTrace();
}
Accessing shared files is as simple as:
try {
SmbFile dummy = new SmbFile( "smb://domain;username:password@server/share/path/to/file.txt" );
SmbFile dest = new SmbFile("smb://server/share/path/to/dir/");
dummy.copyTo(dest);
} catch( SmbAuthException sae ) {
sae.printStackTrace();
} catch( SmbException se ) {
// NETWORK PROBLEMS?
se.printStackTrace();
}
Wednesday, November 7, 2007
Quickstart: libcurl and mingw (plain http)
The win32 builds of libcurl available on the Curl download page have way too many library dependencies (openldap/zlib/openssl etc). That makes sense since curl supports fetching resources using any of those those protocols. However, if all you want to do is just use curl for http use in your program, its simply better to compile the libcurl source to get the tiny libcurl library you need.
The below assumes that you have downloaded and installed mingw and you have mingw32-make in your PATH.
- Grab the libcurl source from the download page. I took curl-7.17.1.zip.
- Extract to a directory (preferably without spaces). We'll call this LIBCURL_HOME
- Open LIBCURL_HOME/lib/setup.h. Add a "#define HTTP_ONLY" (minus quotes ofcourse) just before the first line in the file. This disables all protocols except http. Read LIBCURL_HOME/docs/INSTALL for further information.
- Open a command shell, change to this directory and use command "mingw32-make mingw32". (Read LIBCURL_HOME/docs/INSTALL for more info on this)
- After compilation is finished, you should have 'libcurldll.a' and 'libcurl.a' present in LIBCURL_HOME/lib
- Change directory to LIBCURL_HOME/docs/examples. We'll now attempt to compile and run the simples libcurl example program 'simple.c'
- Run "gcc -DCURL_STATICLIB -I ..\..\include simple.c ..\..\lib\libcurl.a -lws2_32 -lwinmm -o simple" at the command line. Alternatively you can run
"gcc -DCURL_STATICLIB -I ..\..\include simple.c -L..\..\lib -lcurl -lws2_32 -lwinmm -o simple.exe".(See Curl FAQ) - A file 'simple.exe' should be produced. Running this dumps the home page of curl to stdout as shown below
- ws2_32 is the winsock library (you can also do -lwsock32), winmm is a library for windows multimedia - as far as I can see there is only one time function used from this library
A trip to Bannerghatta National Park
This is one of the VERY few places near to Bangalore that still has some wildlife and greenery left - and as a result is a standard weekend destination.
I work in SAP Labs and some colleagues of mine from Walldorf wanted to see some tigers and ride some elephants. This was the closest place around where they could get to see some wildlife. Unfortunately for them, the elephants were 'tired' and so there were no rides scheduled that day. However, we opted in for the wildlife safari and could see some critters. They were happy. :)
Here is a cute tiger!
The more-or-less full album at Bannerghatta Pics
Non-optimized videos at:
White Tiger
Bengal Tiger
Lazy Lionesses
Thursday, November 16, 2006
Elune Evensong/Moonsong - Avatar of Elune, Moon Goddess (Fantasy)
Anybody who has played Warcraft / World of Warcraft knows who is Elune. For the un-initiated, please do refer WoW or Wikipedia!
I do doubt however, that any male is so terminally affected with fantasy that he would day-dream about a goddess's avatar - and an imaginary one at that! I do have the small saving grace that her picture in my mind is not the conventional one of a beautiful Night Elf. No, not at all.. it's one of a spectacular High Elf - one whom I keep dreaming about.
Goddess, Hear my call ! (thats one of the game character voice bites)
Her mane is spun from fair moonlight,
Her eyes are a mirror to the artic sky!
Her voice - a blend of crystal chimes,
Her smile can melt the Sun to cry!
Her verve - the vigor of monsoon wind,
Her art - the height of arcane skill!
Her sight can make any pain rescind!
Her love - the promise of trust fulfilled!
...and her kiss can cause burns on skin!.. :-)
(to be filled in)
Limerick of Inauguration
I have been an on-off blogger for quite some time now, but of the, um.. academic kind using services such as what jRoller , et al offer. I never felt comfortable making posts of a personal nature using those services - I always felt that was the privilege of , ah , rather more accomplished professionals.
And hence this very late blogspot registration, where I can comfortably sink into mass mediocrity without even the slightest twinge of guilt or sentiment.
A toast imaginary readers! A toast to yet more wasted bytes 'an bandwidth ...so please do chant this limerick with me! (which like nearly every other limerick has been begot by reality)
There once was a techie in the city,
Who blogged every little itty-bitty,
He posted thrice every day,
Even with nothing to say,
Till he was hired by a union committee!
