Delay when reading lots of data from IrDA Port

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
pspvideo9
Posts: 19
Joined: Tue Mar 15, 2005 12:32 pm

Delay when reading lots of data from IrDA Port

Post by pspvideo9 »

This problem is still unsolved and we feel it warrants its own thread, instead of being buried in another.

Problem
When using an IR keyboard with the PSP and typing at a high wpm ratio, the letters do not appear on screen in real time, rather they only appear at a much slower rate. For example, say you type something in for 5 seconds, it may take up to 10 seconds before all the letters are printed on the screen.

Cause
There is some sort of internal buffering going on and sceIoRead is not returning data in near real time, even though the PSP is reading all the data correctly in real time.

This was confirmed by moving the PSP out of line of sight after the 5 seconds of typing was completed. Even with the PSP in a different room as the IR keyboard, every letter typed would eventually be displayed on the screen, but only several seconds after typing is complete.

Solution
Unknown. Any ideas?
ooPo
Site Admin
Posts: 2023
Joined: Sat Jan 17, 2004 9:56 am
Location: Canada
Contact:

Post by ooPo »

Have you tried looking at the code at all?
pspvideo9
Posts: 19
Joined: Tue Mar 15, 2005 12:32 pm

Post by pspvideo9 »

Of course we looked at the code, how else would we have got our ThinkOutside IR keyboard working on the PSP.

Even with the following simplified code, there is still some unknown delay in the PSP between reading large amounts of IR data and printing it to the screen.

Code: Select all

int irdafd, len;
irdafd = sceIoOpen("irda0:", PSP_O_RDWR, 0);
while (1)
{
	len = sceIoRead(irdafd, &data, 1);
	if (len != 0) printf("%c", data);
}
sceIoClose(irdafd);
We are also not the only ones to see it, Dr. Vegetable, in his own seperate IR Keyboard driver implementation is also seeing this.
ooPo
Site Admin
Posts: 2023
Joined: Sat Jan 17, 2004 9:56 am
Location: Canada
Contact:

Post by ooPo »

Are you certain it isn't a slow printf implementation that's causing the delay in your example?

Does sceIoRead() block until all the data is read, or will it return partial reads? Would attempting to read a larger amount of data at once result in less of a delay?

Are there some functions that let you set the speed of the irda port?

Try putting a sleep() into your loop to give other threads a chance to run. Perhaps you're starving some part of code that does the actual parsing of irda data.
jimparis
Posts: 1145
Joined: Fri Jun 10, 2005 4:21 am
Location: Boston

Post by jimparis »

Have you tried other open flags like PSP_O_NOWAIT? Just a guess.
Post Reply