Archive for the ‘work’ Category

after a busy week

Thursday, January 26th, 2006

and lots of work

this was a working week.
i mean no blog reading, no net surfing, no slashdot, and only work. didnt even check all mails on students server and not even coffee.
its the raship project. did complete restructuring of project. from code design to GUI design. all great things. and now when it is done, it feels so good. It was real fun/thrill thinking about the system all through, various things like what all interfaces to provide, how do various components talk, making a decent GUI and CLI etc etc. a real good experiance.

Yahoo! blocked my account ( aguy_likeme ). so wont be able to be online on Y! Messenger for couple of days till i create another. I did nothing recently, probably for some old stuff i did on geocities. they say violation of geocities TOS. sad

Upsy gone to home on vaccations. so no talking from about 2 weeks. miss her. and its more than a feet of snow at home. miss home.

have lots of pending stuff to read. people in the cyberspace keep writing nice things. hope tomorrows day will be enough for what i missed in last 7-10 days.

time to sleep with a blank mind.

icpc ‘05

Wednesday, December 14th, 2005

Team : me + Visesh + Ranjeeth
my second attempt.. and also the last..
@ Amrita Vishwa Vidhyapeetham, Coimbatore. 11-12 Dec.

Well.. we stood 20th..
we performed well.. we had 6 solutions working.. and 7th half written.. but only 4 got accepted.. (couldn’t figure out what went wrong with the other 2). sad

The place Ettimadai(location of the University) was nice, with nice climate and beautiful scenery.
Got to know about the ‘hugging saint’ Amma Amritanandamayi, founder of the University. Read more about Amma.

Our was through Bangalore. Had a nice time iiitians out there.. Amal Raj, Piyush, Anubhav, Imran.

Long time no blogging…
Not even reading any blogs(including slashdot).. dont know why. after returning back from home didnt feel like. Google Reader being one of the reason. I can’t fking mark ‘all read’. Shifting back go bloglines. Also was busy with lots of work.

links -
* Google’s secret weapon: simplicity (through Kunal)
* xooglers (through Rakesh)
* Amma Receives the 2002 Gandhi-King Award

ERROR 1359 / raw ir on pocket pc

Saturday, April 30th, 2005

system error 1359 => ERROR_INTERNAL_ERROR => An internal error occurred
Got this error while working with COMM programming. The reason was I was trying raw read/write on a wrong com port (IrCOMM port).

Was working with building science project “Remote on Pocket PC”.

Goal => Read IR signals of a remote, learn them, and be able to generate the same signal.

Conclusion => windows sux or i am not good enough to appreciate the beauty of it.

Yes, unfortunately I was working on windows sad. Coz the pocket pc was windows based. I couldnt help it out.

The problem was simple. Some sockets programming, to read ir from some port, see the singal and send same data out. But the simple problem screwed me totally. I never worked so much on any project like i did for this. Coz a small 50 lines of code was not working. And the people at M$ have made things so much complicated, i dont know why. there are some 15999 error codes mentined at msdn site. Why cant they keep things as simple as they are in GNU/linux. When i work in GNU i understand what is happening, even to the level of kernel. Coz its simple. I guess in M$ no one knows how does windows work. millions of lines of code. sad

We had to install things ( EVC, pocket ps sdk, active synk etc) some 15 times, on 5 different pcs. ( Every installations is more than an hour. sad ) Coz if they are not installed in a fixed order, and with fixed versions and patches they just dont work. And if you have installed it even once wrongly in a system, it will never work again. Can something suck more than this.

Coming back to the problem, read/write IR on pocket pc.

Started with socket programming, but soon figured out that its based on IrDA protocol. That means it does handshake, headers etc stuff. That was not required for me. I just wanted to read and write a simple beam of data without any header stuff. And handshake etc was not at possible. So i had to look for something called “raw IR”.

raw IR

“raw IR” in simple words is reading all that is received by the IR sensor and sends a beam of exactly what you have written. No more no less. Figured out that IR is mapped to a serial port, which can be programmed using COMM programming in windows. com port behaves like a device file of GNU/Linux. Open a file, do read/write and close the file. Looked simple.

I wrote a simple code that opens a COMM port, tries read/write on it. But nothing worked. And this simple thing troubled me for days. I became an expert of serial port aka COMM programming and learnt lots of other fundas of windows but nothing helped me out. The error I was getting was 120 => ERROR_CALL_NOT_IMPLEMENTED (This function is not supported on this system), which i figured out is not the actual error and was randomly being generated somewhere. After ignoring this error the next error was 1359 aka ERROR_INTERNAL_ERROR, which doesnt give any information to me. and neither did google.

raw IR on Pocket PC

My PPC had 2 ports for ir. COM3 and COM4.
The registry of PPC has following enteries for IR -

1. HKLM/Comm/IrDA [ people generally use it to get the port, but i had nothing here ]
2. HKLM/Comm/XSC1_IrDA1/Parms [ port = 4 ]
the path XSC1_IrDA1 used above is written at HKLM/Comm/XSC1_IrDA/Linkage/Route or HKLM/Comm/IrDA/Linkage/Bind
3. HKLM/Drivers/BuiltIn/IrCOMM [ Index = 3, Unimodem/FriendlyName = Infrared Port ]
4. HKLM/Drivers/BuiltIn/IrDA [ Index = 4, FriendlyName = Native IR: ]

From this i could figure out that my ports for IR were
COM4 aka Native IR (its connection to IrDA looks confusig)

This means that COM3 uses a special (low level) IrDA protocol, called IrCOMM.
Raw IR will not work with IrCOMM.
So i have to use COM4 for raw ir. It worked fine.

Another important thing to note -
your PPC might be blocking Native IR port for its own ir use.
Uncheck Start -> Settings -> Connections[tab] -> Beam -> Receive all incoming beams.
The path may differ for you. Coz of it CreateFile failed on COM4 for me and I thought its not the right port. and I kept fighting with the COM3 port and some INTERNAL error.

A simple code to read/write ir -

int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance, LPTSTR lpCmdLine,int nCmdShow){	// OPEN 	HANDLE port;	port = CreateFile( _T(”COM4:”), GENERIC_READ | GENERIC_WRITE, 0, 			NULL, OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL , NULL);

	// FREE		EscapeCommFunction( port, SETIR);

	// SETUP : BUFFER	SetupComm(port, 2048, 2048);	PurgeComm(port, PURGE_TXABORT | PURGE_RXABORT | PURGE_TXCLEAR | PURGE_RXCLEAR);	// SETUP : IRDA port settings	DCB dcb;	dcb.DCBlength = sizeof(DCB);	GetCommState(port, &dcb);	dcb.BaudRate          = CBR_115200;	dcb.fBinary           = TRUE;	dcb.fParity           = TRUE ; 	dcb.fOutxCtsFlow      = FALSE;	dcb.fOutxDsrFlow      = FALSE;	dcb.fDtrControl       = DTR_CONTROL_DISABLE;	dcb.fDsrSensitivity   = FALSE;	dcb.fTXContinueOnXoff = FALSE;	dcb.fOutX             = FALSE;	dcb.fInX              = FALSE;	dcb.fErrorChar        = FALSE;  	dcb.fNull             = FALSE;	dcb.fRtsControl       = RTS_CONTROL_DISABLE;	dcb.fAbortOnError     = TRUE;	dcb.ByteSize          = 8; 	dcb.Parity            = EVENPARITY; 	dcb.StopBits          = TWOSTOPBITS;	dcb.Parity            = EVENPARITY;	SetCommState(port, &dcb);

	// SETUP : TIMEOUT	COMMTIMEOUTS timeouts;	GetCommTimeouts(port, &timeouts);	timeouts.ReadIntervalTimeout         = MAXDWORD;	timeouts.ReadTotalTimeoutMultiplier  = 0;	timeouts.ReadTotalTimeoutConstant    = 0;	timeouts.WriteTotalTimeoutMultiplier = 0;	timeouts.WriteTotalTimeoutConstant   = 0;	SetCommTimeouts(port, &timeouts);

	// READ/WRITE	// Using ReadFile and WriteFile

	// Read	BYTE buf[256];	unsigned long b;	int a;	for( int n=0; n<20; n++){ // 20 tries		a = ReadFile( port, buf, 255, &b, 0 );		if( b >0 ){			// b bytes read… display them			/*			sprintf(mesg,”Yahooo %d bytes read\r\n[%s]”, b, buf );			MessageBox( NULL, s3 , _T( “check” ), MB_OKCANCEL ) 			*/		}	}

	// Write	/*	unsigned long b;	int a = WriteFile(port, “1234567890″, 8, &b, NULL);	*/

	// END	PurgeComm(port, PURGE_TXABORT | PURGE_RXABORT | PURGE_TXCLEAR | PURGE_RXCLEAR);	CloseHandle(port);	return 0;}

download a simple code to read/write raw IR from here

* Code Project / Pocket PC TV Remote Control By Nick Deacon
* Raw IR on Pocket PC
* Vito Remote and Oscilloscope
* ePanorama / Infrared remote control technology
* Lists the 15999 system error codes
* and now this page too

Updated May 18th ‘05: Code added. Made more readable seeing large no of hits.

The Indus Entrepreneurs

Monday, April 18th, 2005

I am a member of TiE Hyderabad chapter now.
With Tarun and Sachin. First student members of TiE Hyderabad.
Abhinav is going to join TiE Delhi and Ankit is going to join TiE Bangalore.

The Indus Entrepreneurs
Hyderabad Chapter

Links : About TiE, TiE global, TiE Hyderabad

Latest deveolopments on our entrepreneurship -
* We are working on 2 products.
* One will be released soon, in IIIT as a 0.1b version. Something web based.
* We are continuing our MS/jobs and parellely giving time to our company as well.
* Looking for (level 0) incubation at IIIT. But Prof Kamal doesn’t seems to be intrested. Isn’t giving us time for meetings. Not even replying to our mails.
* Name of the company is not yet decided. You can suggest a name for us. Accepted name gets 1% equity.