PSP 2 PSP communication example with IrDA

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

Moderators: cheriff, TyRaNiD

Post Reply
Shine
Posts: 728
Joined: Fri Dec 03, 2004 12:10 pm
Location: Germany

PSP 2 PSP communication example with IrDA

Post by Shine »

Source and precompiled for 1.0 and 1.5 firmware. I have tested it with one 1.0 firmware PSP and one 1.5 and it works until ca. 30 cm.
Laurens
Posts: 14
Joined: Tue Jun 28, 2005 10:26 pm

Post by Laurens »

Great, thanks! Nice & simple :) FYI: It's in the svn-repository now, thanks to Jim.
If a beautiful girl tells you she's done some modeling work in the past, and you ask her what 3D software she used, you might be a gamedeveloper.
User avatar
EdwardFMA
Posts: 40
Joined: Wed Jul 06, 2005 11:47 am

Post by EdwardFMA »

Ok two thing
1. Do TV's use IRDA?

if so is this correct?
#include <pspkernel.h>
#include <pspctrl.h>
#include <pspdebug.h>
#include <pspiofilemgr.h>
#include <stdlib.h>
#include <string.h>

PSP_MODULE_INFO("PSPDEMO4", 0, 1, 1);
PSP_MAIN_THREAD_ATTR(0);

#define printf pspDebugScreenPrintf
#define REPEAT_TIME 0x40000
static unsigned long control_bef_ctl = 0;
static unsigned long control_bef_tick = 0;

int exit_callback(void)
{
sceKernelExitGame();

return 0;
}

void CallbackThread(void *arg)
{
int cbid;

cbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL);
sceKernelRegisterExitCallback(cbid);

sceKernelSleepThreadCB();
}

int SetupCallbacks(void)
{
int thid = 0;

thid = sceKernelCreateThread("update_thread", CallbackThread, 0x11, 0xFA0, 0, 0);
if(thid >= 0)
{
sceKernelStartThread(thid, 0, 0);
}

return thid;
}

unsigned long Read_Key(void) {
ctrl_data_t key;

sceCtrlSetSamplingCycle(0);
sceCtrlSetSamplingMode(1);
sceCtrlReadBufferPositive(&key, 1);
if (key.buttons == control_bef_ctl) {
if ((key.frame - control_bef_tick) > REPEAT_TIME) {
return control_bef_ctl;
}
return 0;
}
control_bef_ctl = key.buttons;
control_bef_tick = key.frame;
return control_bef_ctl;
}

int main(void)
{
unsigned long ctrl;
int fd = sceIoOpen("irda0:", PSP_O_RDWR, 0);

SetupCallbacks();
pspDebugScreenInit();
printf("Remote for Daewoo DVD Player\n");
printf("Power on/off - start");

while(1)
{
ctrl = Read_Key();
if (ctrl & CTRL_START)
{
unsigned long padHighbyte = 0x000000000000708F;
sceIoWrite(fd, &padHighbyte, 1);
}
}
return 0;
}
2. If you made a Driver that reads a infared device on the serial port could you use the PSP as a Controller on a PC?
EdwardFMA/IchigoKurosaki - PSP Expert
Athlon 64 - Socket 939 - 3000+
1GB 333 DDR-Ram
Geforce 6600 GT PCI-Express

Orbis PSP Development
Open-Source Development
Shine
Posts: 728
Joined: Fri Dec 03, 2004 12:10 pm
Location: Germany

Post by Shine »

EdwardFMA wrote:Ok two thing
1. Do TV's use IRDA?
No, use the SIRCS example for this (but works for Sony devices only)
EdwardFMA wrote:2. If you made a Driver that reads a infared device on the serial port could you use the PSP as a Controller on a PC?
Yes, this is possible, but would be better to use SIRCS and a selfmade receiver, because IrDA doesn't work if the PSP is more than 30 cm away from the receiver.
LiquidIce
Posts: 55
Joined: Mon Apr 04, 2005 1:15 am
Contact:

Post by LiquidIce »

Would it be possible to convert an IR code from say, a phillips pronto, into a sircs code that can be sent out from the PSP? There are thousands of pronto codes for download on remotecentral.com, it would be neat to have an eboot which holds a database of all of them.

Regular remotes can have a carrier, a repeat rate alternating bits, etc.. The pronto code is just some hex values with the first few bytes being the freqency, carrier and repeat rate, then an on/off pulse train with a lead out at the end. If you hold down the button on some IR remotes it will send a different code when you release it. (A volume up command for example)
Sircs, sends out the same bytes no matter how long you hold down the button.

So AFAIK, the two code types are incompatible.
Someone please prove me wrong, and post a link to some PRONTO -> SIRCS conversion info.

Some additional reading:
SIRCS protocol:
http://www.edcheung.com/automa/sircs.htm
Shine
Posts: 728
Joined: Fri Dec 03, 2004 12:10 pm
Location: Germany

Post by Shine »

LiquidIce wrote:Would it be possible to convert an IR code from say, a phillips pronto, into a sircs code that can be sent out from the PSP? There are thousands of pronto codes for download on remotecentral.com, it would be neat to have an eboot which holds a database of all of them.
You are right, it is not possible with the SIRCS example, because SIRCS has a fixed carrier and frequency, see this topic for details. But perhaps it is possible to program the IR led of the PSP to use other values by direct accessing the hardware. It should be possible, because it is used for IrDA and SIRCS, which are very different from each other, but for this you have to analyze the kernel in more detail.
BeBopFMA
Posts: 3
Joined: Mon Aug 22, 2005 10:00 am
Location: illinois
Contact:

psportal

Post by BeBopFMA »

i really liked edwardfma's portal and it is by far tha best one i hav seen but i was wondering if anybody could tell me if there was anyother way besides dreamweaver (cause i didnt wnt to spend 299$ on tha program and tha download didnt wrk)to mak a portal help wuld be grt thankx



ps..... MAJOR PROPS to edward fma again cnt wait t osee more portals!!
djstriker91
Posts: 2
Joined: Tue Aug 23, 2005 10:04 am

Re: psportal

Post by djstriker91 »

BeBopFMA wrote:i really liked edwardfma's portal and it is by far tha best one i hav seen but i was wondering if anybody could tell me if there was anyother way besides dreamweaver (cause i didnt wnt to spend 299$ on tha program and tha download didnt wrk)to mak a portal help wuld be grt thankx



ps..... MAJOR PROPS to edward fma again cnt wait t osee more portals!!
Copy and mess around with the source (from another portal) in Microsoft Word would probably work too.
BeBopFMA
Posts: 3
Joined: Mon Aug 22, 2005 10:00 am
Location: illinois
Contact:

Post by BeBopFMA »

thankx alot tht will really help. soon i will be posting a link to one of my portals i will hav photos of tha prototype soon, i pln on makin it an alienware theme. features(culd chang)gud size start bar,desktop icons, more games, and i also will be hopefully adding a kind of windows media/ mp3 player i hav a friend whos helpin but dont get ur hopes up.

thts all tha info i got for now more later!!
BeBopFMA
Posts: 3
Joined: Mon Aug 22, 2005 10:00 am
Location: illinois
Contact:

Post by BeBopFMA »

[img]http://final pics_url[/img]

well if u cnt see tha pic email me at my address[clik on mail icon]

but this is the early prototype for my portal!! sry t oedwardFMA for copying his clock an som images but he will recive credit for tha portal too

all for now
User avatar
EdwardFMA
Posts: 40
Joined: Wed Jul 06, 2005 11:47 am

Post by EdwardFMA »

Thanks for the Comments i have had to rename my portal to ASR/EdwardFMA Web Portal due to problem with WinPSPortal due to the problems i stopped make the unofficial versions and i'm going to release another one that looks like Windows CE.
but this is the early prototype for my portal!! sry t oedwardFMA for copying his clock an som images but he will recive credit for tha portal too
I don't mind all my work is Open Source and can be used just give credit. ;)

BTW My website is down due to me exceeding my 2GB Bandwidth Linit it should be up by Thursday this week
EdwardFMA/IchigoKurosaki - PSP Expert
Athlon 64 - Socket 939 - 3000+
1GB 333 DDR-Ram
Geforce 6600 GT PCI-Express

Orbis PSP Development
Open-Source Development
User avatar
dot_blank
Posts: 498
Joined: Wed Sep 28, 2005 8:47 am
Location: Brasil

Post by dot_blank »

this thread has digressed over towards
portals and what not....

i wouldnt be surprised that these two are
one in the same ...if so shame on you

anyway back to topic :P

if IrDA cannot exceed 30 cm distance
is this a problem with the above example
or is this the brick wall that is the PSP
hardware

to receive or not to receive
home building of own receiver that
converts any pronto codes into sircs
is best option but then how will your
receiver transmit to tv set top box

unless your receiver is hard wired to
said box ;)

added complexity is needed to something
so simple as me trying to control a crappy 17"
no name brand tv box 8) ...
... and not all tvs use sircs...

...what about altering your own tv hardware's
receiver ;) thus making that tv receiver hard wired no

but i digress ....back to what i need to know
is 30 cm the max or what
10011011 00101010 11010111 10001001 10111010
Post Reply