Thursday, January 29, 2009

web programming in python

A while back, Prasad and I managed to do some web programming in Python using the tutorial: http://webpython.codepoint.net/. We dived directly into mod_python and hacked up a python script that took a link it and downloaded it to the home folder. We used wget -c to do that.

When we wanted to download torrents, we came across aria2c that could handle all kinds of downloads. We tried putting it in place of wget, but somehow, it did not work. It is been quite a while since we got back onto that.

From 2 days, I have been trying to get the openfiler to give me the same functionality, but could not succeed using mod_python (though I downloaded it from the openfiler conary repository; Apache complains of a version mismatch). So, I went the CGI way and got some basic scripts working.

Have multiple ways to do web programming is a big boon! What next?

Tuesday, January 20, 2009

WebDAV in openfiler


I could get the WebDAV working on openfiler to view the share thanks to Nautilus, the gnome file manager.
Here's how it looks:

To access a WebDAV share from Nautilus, goto File, Connect to server, choose WebDAV in the combo box on the top and enter your settings like:

openfiler configuration from forums.openfiler.com

I found this pretty useful to configure the openfiler: https://forums.openfiler.com/viewtopic.php?id=2491

Monday, January 19, 2009

NFS up and running on Openfiler.

today morning, I was able to setup a client on my laptop running ubuntu to connect to the NFS server running on the Openfiler.

A while back, I had created a share on the Openfiler from the shares tab. I had to give access to the share using the network configuration. I tried giving 192.158.0.* so that all machines on my network could access the share, but don't know why it did not work. So, I created a specific entry with my laptop's ip address, gave it rw access for NFS.

Then, I used the configuration specified on the ubuntu forums for NFS and could copy a big video into the share after i 'mount'ed the share on my laptop.

I seem to have a problem on my laptop with the version of libc it is running, so, I had to manually pick up the nfs-common and the related debs and install them via dpkg.

So, this looks good so far.

Sunday, January 18, 2009

OMAP - in brief

OMAP and DaVinci Software For Dummies - THE book for beginners:

omap_dummies_cover

Since a couple of weeks (or probably more), www.beagleboard.org has had a mention about a book called "OMAP and DaVinci Software For  Dummies". The companion website was pretty impressive too. Especially since Me was an absolute novice when it came to OMAP or any of TI's products, excepting the recent experiences with Beagle. Proceeded to order it thru myTI, expecting that it might cost me, that too in dollars. Was pleasantly surprised to see that the order went through without a mention of any charge at all.

A couple of weeks later, this nice little book dropped into my mail box. About 106 pages in all, it was written for absolute novices - who knew nothing about OMAP or DaVinci. And that, precisely, is what Me needed at this juncture.

The reading experience was a cruise. Took about a couple of hours of my train journey from Bangalore to Hyderabad. Apart from covering all major aspects of OMAP and DaVinci, this book also featured a good set of cartoons at few places - my fav one being "The 5th Wave" by Rich Tennant - "Oh come on... how fatal can it be?". Here's a copy of the cartoon - all credits to Rich Tennant. The authors - Steve Blonstein and Alan Campbell - did a pretty good job at striking a right balance between keeping the language simple and yet driving home the point about how sophisticated this stuff is. Worthy of mention are the icons that draw the attention of reader to some specific tit bits of information. There are a lot of TLA's dispersed around in the book - but are just right in volume - atleast Me didn't get driven away mad. ;-)

The book has three parts:

The first part starts with a good discussion about how multi-core architectures have come to be of such prominence in today's world, introduces the OMAP and DaVinci platforms, discusses the operating systems and kernels available, the various standards that TI had come up with to make the lives of developers easy and the software frameworks in place for these platforms.

The second part walks the reader through a hands-on. If followed through, the reader can end up with software that utilizes the video and audio parts of OMAP processor.

The last part - gather that this is a standard feature of all For Dummies books - gives very useful information - TI's recommendations for Codecs and pointers to resources that will help developers.

OMAP and DaVinci Platforms:

OMAP and DaVinci SOCs are hybrid in nature - they typically contain a GPP (General Purpose Processor) and a DSP (Digital Signal Processor). The task scheduler for the DSP is a lightweight scheduler called DSP/ BIOS. The For the GPP the SOC leverages the wonderful world of Linux (other operating systems can also be ported though.)

DSP/BIOS - there is apparently a perennial discussion about if this is actually an operating system or if it is a scheduling kernel - is ideal for the real time DSP task scheduling due to its key attributes - high scalability, high speed and low latency. The book prescribes Linux - community based or the commercial ones - as the right platform that can leverage the GPP in these SOCs to the best possible extent.

TI seems to have done tremendous work in the world of Codecs and addressed a lot of problems related to inter-operability, packaging and deploying quite efficiently. XDAIS, XDM, RTSC etc., seem to give a system integrator the freedom to try various Codecs and the scalability to switch between platforms easily.

TI apparently also has a whole lot of supporting software for these platforms - various VISA codecs, DVSDKs, Code Composer Studio, QualiTI, packaging tools - that make the lives of a system integrator far easier that what it was before. The best part, most of these software are available free for the community. The platform specific packages, Me gathers, leverage the potential of open source communities to a good extent.

All in all, a wonderful book for beginners. A perfect ten on ten for the way the material is presented - simple and interesting. Gave me a good list of things to try on Beagle. A must for everyone starting off on OMAP or DaVinci platforms.

Me's never bothered to check, so far, what TI has been upto with its products, in detail. The more Me learns about their products and their passion towards keeping things open - Me's becoming quite a fan of TI.

Me.

Further reading:

Dummies Book online: www.ti.com/dummiesbook

Friday, January 16, 2009

Openfiler...got it installing!

Yes, the first time I thought I am expert and went right ahead, but I missed the instructions in the installation guide. Radha pointed out to me what the problem could be, so, I tried the install a second time with free space left out after /boot, / and swap. It installed neat and I could create a share out of the free space :-)

So, I have a 100MB for /boot, 10GB for / and 4GB for swap and the rest of 198GB is being used as share. I need to see how to setup NFS/Samba/LDAP/FTP now. This is perhaps the time for me to lookup the v1.1 manual though dated but surely of some help (http://wwwold.openfiler.com/docs/manual/).

So, onto the configurations! I have added a group and a user for a start.
-raghav

Thursday, January 15, 2009

Synergy works!

Me had worked around the problems Me was facing with getting the keyboard to work.

  • Me could log into angstrom from the serial connection. Realized that this would be just another login session as far as Angstrom was concerned.
  • Ethernet was working without any problem, so could run opkg install commands.
  • Installed Synergy and started it as a client.
  • Configured Synergy on my PC as a server.

 

Voila! Now, Me can use my keyboard and mouse connected to my PC to work with beagle!

The first thing Me did was to enable autologin in Angstrom, and add the synergy client to startup.

Alleviates some pain till Me gets a USB keyboard to check with the USB hub and beagle.

-Me.

Keyboard problems!

Once Me got my USB A to Mini-AB cable done, my next task was to get a minimal set of peripherals working with the Angstrom demo distribution.

So, this is what my setup looked like.

USB-A to mini-AB connected to a female-USB to female-USB adapter, which was connected to a self powered USB 2.0 hub. Connected to the hub were a USB to ethernet adapter and a USB to PS2 adapter, to which a PS2 keyboard and mouse were connected.

When angstrom booted in, Me couldn't log in - neither the keyboard and mouse were working. Had to go about the elimination way to figure out what was happening.

When Me had only a USB mouse connected to the hub, Angstrom booted with mouse enabled and Me could log in. Connected the USB to ethernet adapter and was glad to see the ethernet work too.

However, the moment Me connected the USB to PS2 adapter, the USB to ethernet was disabled, and neither did the mouse work. Noticed a bunch of statements on the serial port - which indicated that the corresponding USB ports were disabled.

Looks like the USB to PS2 adapter is the culprit. Can't exactly figure out what was happening, but Me thinks its drawing too much power off the hub due to which the hub was disabling the other ports. Or its probably that the hub itself was faulty. What perplexes me is that the USB to PS2 adapter to keyboard-and-mouse works fine on my Windows laptop without these problems.

Can't quite explain or pin down the problem to a particular component. However, the next immediate steps would be to:

  1. Check if a USB keyboard works fine along with the mouse and USB to Ethernet connected to the hub.
  2. If that doesn't work, then check with a different USB hub.

 

-Me.

USB-OTG - A brief

Dealing with the USB OTG on Beagle has been quite a learning experience, especially, since my knowledge of USB was very minimal. This is Me's attempt at providing a brief about USB OTG.

USB was first introduced to address desktop's connectivity with various peripherals - printer, mouse, keyboard, serial, parallel, PS2 etc. It was quite successful - so much so that almost all peripherals and devices that need PC connectivity these days use USB.

USB has further been extended to other devices, mobile phones in particular and the functionality has been extended from mere PC connectivity to include charging, transferring video etc.

The USB master/ slave architecture that USB generally used - where a host acts as a protocol master and a USB device (peripherals) act as the slave - were sufficient to address most usage scenarios. The host always initiated the configuration/ data transfer from the peripherals in these cases.

Specifically, a usage model started emerging - the one where a device needed to either act as a host or a peripheral based on the situation. A typical example would be when two mobile phones could be connected for data transfer - where one would act as a device and the other as a peripheral. The same mobile also needed to act as a peripheral when connected to a PC. A need to have one connector on the mobile for all purposes - charging, to connect audio headsets, for data transfer - also played an important role in the introduction of USB OTG during late 2005 - early 2006 timeframe. The miniature nature of these devices also resulted in mini USB connectors to suit their form factors.

USB On The Go - USB OTG in short - introduced  two new protocols: SRP - Session Request Protocol and HNP - Host Negotiation Protocol.

SRP allows both communicating devices to control when the link's power session is active. This was not available in the standard USB spec - only the host was capable of doing so. This fine control over the power consumption resulted in significant power savings in battery operated devices like cameras and mobile phones.

HNP allows the two devices to exchange their Host/Device roles, provided both are OTG dual-role devices.

USB OTG protocols cannot pass through a standard USB hub - since they are based on physical electrical signalling.

USB OTG defines two roles of devices: OTG A-device and OTG B-device. The terminology defines which side supplies power to the link, and which is initially the host.

OTG A-device is a power supplier, and an OTG B-device is a power consumer. The default link configuration is that A-device acts as a USB host and B-device is a USB device. The modes may be exchanged later by using HNP.

USB OTG standard introduces a new plug receptacle called mini-AB. It can accept either a mini-A connector or a mini-B connector. USB OTG also adds a fifth pin to the standard USB connector called the ID-pin.

The mini-A connector has the ID pin grounded (connected to GND), while the ID in the mini-B connector is floating (non-grounded).

A device that has a mini-A plugged in becomes an OTG A-device and the one that has mini-B plugged in becomes a OTG B-device. The type of the plug inserted is detected by the state of the ID pin.

Beagle Context:

Beagle has a mini-AB connector and has both modes of operation. When connected to a PC it is a peripheral and when it is connected to other devices like a USB hub, keyboard, mouse, USB Ethernet etc, it playes the role of a host. When Beagle is required to play the role of a host, the cable that is required would need to be in the OTG-A mode.

In the market, almost all USB cables with a mini-AB connector are of OTG-B configuration. Me had scourged the local markets in Bangalore and Hyderabad, and couldn't find a cable that was made in a mini-A configuration. What makes matters worse that none of these cables had any indication about whether the cable has OTG-A or OTG-B configurations. The shopkeepers would hardly understand OTG, complicating things a little further.

2009-01-10-32267

So, to get USB on my Beagle working, Me had to choose between meddling with the board and modifying a cable. For obvious reasons, Me choose to modify the cable. Lucky for me the connector opened up pretty easily. But unfortunately, unlike the other pins, the ID pin was trimmed off making it very challenging to connect it to the GND pin.

After a whole lot of struggle, ended up with a connection as shown in the picture here. Had to take a small strand from a USB cable that Me had opened up earlier, use the solder to firm it up, and then put up a struggle to connect it between the ID and GND pins, making sure that it didn't touch any of the other pins.

Me's opinion - USB standard or atleast the cable manufacturers should come up with a standard way of indicating the OTG configuration that the USB A to mini-AB cables are made of. If not anything, that'd save some time and effort for folks who scourge the markets for specific cables.

-Me.

Further reading:

USB OTG on Wikipedia: http://en.wikipedia.org/wiki/USB_On-The-Go

USB OTG on the USB.org website: http://www.usb.org/developers/onthego

Maxim's app note on USB On-The-Go Basics: http://www.maxim-ic.com/appnotes.cfm/an_pk/1822

Sunday, January 11, 2009

Openfiler...NAS in Linux

We were looking for a NAS in Linux and we came across Openfiler. Looks quite interesting. I have it installed on a system here at home. I was looking to administer it and ended up with my first ever chat on IRC. #openfiler on irc.freenode.net.

Here's the chat script:
(07:41:26 IST) The topic for #openfiler is: ..::openfiler::.. - A place to talk about openfiler and SAN, please use a pastebin instead of flooding http://openfiler.com - Non openfiler? #san
(07:48:39 IST) raghav_n1: hi folks. i have just installed openfiler and was looking for some documents to manage/administer the system. but, i am unable to find them on http://www.openfiler.com/learn. is there some other place i need to look?
(07:49:30 IST) rafiu: raghav_n1: forums is a very good place to start
(07:49:34 IST) rafiu: https://forums.openfiler.com
(07:50:42 IST) raghav_n1: thank you! i am looking at the forums now.
(07:54:13 IST) Stanlin: raghav_n1: it is going to crash
(07:54:41 IST) rafiu: Stanlin: what's up with you?
(07:55:45 IST) raghav_n1: Stanlin: sorry, i did not understand what you meant
(08:01:53 IST) Stanlin: raghav_n1: OF is amazing.. keep using
(08:03:16 IST) Stanlin: rafiu: joking man
(08:06:46 IST) raghav_n1: Stanlin: i am beginning to get a feel of OF. looking into the forums to get my OF up and running. OF looks good to me!
(08:07:11 IST) Stanlin: raghav_n1: its so easy, boot it, open the web interface, click here there... voila
(08:10:10 IST) raghav_n1: Stanlin: i am sure it is. just that i need to get used to it a bit.
(08:15:24 IST) Stanlin: well depends on your experience, was like 5 mins for me

Got to get this working!
-raghav