Tech Talk

Linux, Python, E51, Scripting…

Posts Tagged ‘python

Python, E51 and Sid

without comments

I installed python almost immediately after I picked my phone, about six months back. But I forgot all about it! Yesterday, I decided to fix it up for good and start getting my phone do some of my work?

As a first step, I’ve had tremendous success getting python over a bluetooth serial console to work. Of course, sincere thanks to google and other hackers who have tried and tested this method before me. First thing I ever did is to repeat what I did to get my older 6111 to talk to sarge. It is available here. That worked like a piece of cake. I installed a newer python and the python shell using this method.

I tried connecting to python over bluetooth serial console. But I don’t think I ever got it right. So google and I got these links.

http://ramblingfoo.blogspot.com/2007/05/bluetooth-fun-with-my-nokia-6600.html

https://bugs.launchpad.net/ubuntu/+source/bluez-utils/+bug/227429

Both had the most vital information to get started. Here is what I did.

$ sdptool add --channel=4 SP
$ rfcomm listen 1 4

I used 1 because I tried setting my debian to use 0 at startup. Another “fail” attempt that one.

In another terminal,

$ screen /dev/rfcomm1

It had some wierd characters to start, just press enter and a new interactive python prompt appears. I checked to ensure that it is the one on the phone and not on my machine!

Now to try something useful

Written by abiya

December 13, 2008 at 2:41 am

Posted in E51, debian, nokia, python, technical

Tagged with , , , ,

PyParsing with Verilog

without comments

I came across this python parsing library called pyparsing through my adviser. The first thing I wanted to try implementing on this is a verilog parser. Actually, the site’ pages allows us to request a verilog parser from the author for non-commercial purposes. Anyways, thats not the point. I know and understand some verilog. So it makes more sense for me to try a verilog parser first. I have my parser for structural verilog using this module in my pbwiki page. It cannot handle many cases yet. But I took about an hour to get that code done. I spent about a day or two trying to figure out pyparsing itself. The documentation is fairly good. There are some interesting code snippets and howto in the pyparsing wiki page.

Now I am writing a full fledged verilog parser using this module. I’ve not requested for the author’s script yet. Maybe I’ll do that once I complete to figure out how good I am in using this library. And the full semantic/syntactic specification is available in IEEE explore and in Samir Palnitkar’s book on verilog HDL. I am not sure how much time I can devote to this, so it could be some time before I’ve followed this up. Meanwhile you might want to check the various samples in the pyparsing wiki.

Written by abiya

October 29, 2007 at 10:49 am

Demo-ing python XML abilities

without comments

I have been using python for a while now, but I never have to use the XML processing capabilities of this language! Yesterday I tried writing a quick and dirty way to convert an open office worksheet into a simpler XML. Actually not much reason to do this myself. Rama was doing something with worksheets and I decided to give this a shot. And within 15-20 minutes I have a simple XML output parsed out of the huge XML that open office format already is. That is precisely why I love writing python code.

Here is the script. Don’t bother commenting if the python language constructs are ill formed. I learn very slow if my work gets done before I learnt it all!

Written by abiya

October 24, 2007 at 5:20 am

Posted in python, samples, technical

Tagged with , , , ,