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?
Delay when reading lots of data from IrDA Port
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.
We are also not the only ones to see it, Dr. Vegetable, in his own seperate IR Keyboard driver implementation is also seeing this.
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);
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.
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.