| View previous topic :: View next topic |
| Author |
Message |
monsti
Joined: 04 Mar 2007 Posts: 13 Location: Germany
|
|
| Back to top |
|
 |
harleyg

Joined: 05 Oct 2005 Posts: 123
|
Posted: Sun Mar 04, 2007 3:45 am Post subject: |
|
|
| Nice, will be using this soon. :) |
|
| Back to top |
|
 |
monsti
Joined: 04 Mar 2007 Posts: 13 Location: Germany
|
Posted: Sun Mar 04, 2007 3:59 am Post subject: |
|
|
| harleyg wrote: | | Nice, will be using this soon. :) |
I think we'll need a prx version to allow applications adding new keyboards without recompiling. |
|
| Back to top |
|
 |
harleyg

Joined: 05 Oct 2005 Posts: 123
|
Posted: Sun Mar 04, 2007 4:58 am Post subject: |
|
|
| Why not read keymaps etc from files? |
|
| Back to top |
|
 |
monsti
Joined: 04 Mar 2007 Posts: 13 Location: Germany
|
Posted: Sun Mar 04, 2007 5:58 am Post subject: |
|
|
| harleyg wrote: | | Why not read keymaps etc from files? |
Keymaps are already read by files. I am speaking of creating a PRX based api - a kind of "driver" concept. New pspirkeyb.prx versions can support more keyboards.
IR Keyboards are no linear "IR byte" to "key" mapping. Every keyboard has it's own protocol :(
So it might be a good idea to make a prx and let the user replace the prx without the need of recompiling the application.
Monsti |
|
| Back to top |
|
 |
monsti
Joined: 04 Mar 2007 Posts: 13 Location: Germany
|
Posted: Tue Mar 06, 2007 12:34 am Post subject: |
|
|
Hi!
I added a PRX version for pspirkeyb. My intension is to create a prx frontent to the static lib in order to allow a dynamic change for applications using PSP IrKeyb.
But... I can't load the prx. Can somebody please have a look at the sources? _________________ Bye,
Monsti |
|
| Back to top |
|
 |
danzel
Joined: 04 Nov 2005 Posts: 182
|
Posted: Tue Mar 13, 2007 5:02 pm Post subject: |
|
|
I'm looking at integrating this into an app.
How do you set the files up on your memory stick? It looks like it should be as follows:
| Code: | ms0:/seplugins/pspirkeyb.ini
ms0:/seplugins/keymap/default.ini
ms0:/seplugins/keymap/azert-include.ini
<repeat for other keymaps>
|
Just asking as it isn't documented anywhere from what I've seen.
Also, I take it that the list of keyboards in pspirkeyb/libpspirkeyb/config/pspirkeyb.ini is correct and up to date? Will go get a keyboard tomorrow if I can find one. |
|
| Back to top |
|
 |
harleyg

Joined: 05 Oct 2005 Posts: 123
|
Posted: Tue Mar 13, 2007 5:54 pm Post subject: |
|
|
| They should be customizable danzel, look at the defines. |
|
| Back to top |
|
 |
danzel
Joined: 04 Nov 2005 Posts: 182
|
Posted: Tue Mar 13, 2007 6:14 pm Post subject: |
|
|
| It would be better to have a standard, then other apps using it don't need to duplicate files around the place. |
|
| Back to top |
|
 |
futaris
Joined: 28 Dec 2005 Posts: 45
|
|
| Back to top |
|
 |
futaris
Joined: 28 Dec 2005 Posts: 45
|
Posted: Fri Mar 23, 2007 6:50 pm Post subject: |
|
|
I did a quick hack of tydopad to confirm keymaps. It's definitely right, but we may need to handle more Shift/Fn-keys, somehow. This keyboard has a Blue Fn key, a Green Fn-Key and the standard shift key. This is mainly because it has no number row. Look inside the above mentioned devkit20.zip to see what I mean.
http://files.futaris.org/psp/tydopad/
I'll do up a keymap for pspirkeyb once we figure out how to integrate it "nicely", especially for the extra Fn-modes, to handle the number row, etc.
Otherwise, does anyone have any objections to me "fixing" the current code for the Palm UW keyboard driver? |
|
| Back to top |
|
 |
tyranos
Joined: 20 Apr 2006 Posts: 8
|
Posted: Sat Mar 24, 2007 3:15 am Post subject: |
|
|
futaris i successfully build a driver for my keyboard thx to monsti s help ,
and to make the numbers work u just have to have the code for the fn funktion in the keymap ,everyting else should be done in the ini files of pspirkeyb , and if it works with pspirkeyb , it s likely gonna work with pikey but u d need to recompile it urself , all u habe to do is to read the README.ADDING.KEYBOARDS in libpspirkeyb , or pm me maybe i can help |
|
| Back to top |
|
 |
futaris
Joined: 28 Dec 2005 Posts: 45
|
Posted: Sat Mar 24, 2007 7:25 am Post subject: |
|
|
I have no problem adding the keyboard driver. It's the Fn code stuff. Most keyboards are 5-row, with a number row. Most don't have F1-F12. These are done with Fn-Keys.
My Keyboard is 4-rows. It doesn't have a number row. If you want the symbol &, you must push Shift+Fn+U. Also there is a num-lock key, etc. My Logitech keyboard has a F mode key for the Function keys.
I can see the need for multiple Fn keymaps. But is this a keyboard-specific thing or something that should be written for all of them?
Also, what about extended keycodes, eg ZOOM_IN / ZOOM_OUT, NEXT SONG, PREV SONG, VOL UP, VOL DOWN, etc, etc. Some keyboards have these. Just look at any Linux keyboard driver. |
|
| Back to top |
|
 |
Fanjita
Joined: 28 Sep 2005 Posts: 217
|
Posted: Sat Mar 24, 2007 9:25 am Post subject: |
|
|
| futaris wrote: |
I'd like to add a driver for this too, but does it belong in this or just in PiKey? |
Assuming your driver fits naturally in libpspirkeyb, I'd recommend putting it there, and then more people can benefit from it - since piKey just picks up the pspirkeyb lib and so can make use of any changes people add to the lib. _________________ Got a v2.0-v2.80 firmware PSP? Download the eLoader here to run homebrew on it!
The PSP Homebrew Database needs you! |
|
| Back to top |
|
 |
futaris
Joined: 28 Dec 2005 Posts: 45
|
Posted: Sat Mar 24, 2007 1:05 pm Post subject: |
|
|
| Fanjita wrote: |
Assuming your driver fits naturally in libpspirkeyb, I'd recommend putting it there, and then more people can benefit from it - since piKey just picks up the pspirkeyb lib and so can make use of any changes people add to the lib. |
Ok. I didn't mention this before, but the Visor Stowaway Keyboard is a RS232 keyboard that runs at LVTTL levels. i.e. you can wire it directly up to the headphone serial port cable, without any extra circuitry. Runs at 9600bps, and I think the 3.3V power pin on the headphone connector supplies enough current. I guess no-one has put a "plain" serial (non IR) keyboard into libpspirkeyb yet?
These are still around on eBay for US$5-$10 generally. Only three wires needed TX, GND and PWR. |
|
| Back to top |
|
 |
Fanjita
Joined: 28 Sep 2005 Posts: 217
|
Posted: Sat Mar 24, 2007 10:56 pm Post subject: |
|
|
In that case I would suggest talking to monsti about the direction he feels his lib should be developing towards, but I would guess that a serial keyboard isn't a natural fit.
It certainly sounds like something we'd like a driver for in piKey, one way or the other. _________________ Got a v2.0-v2.80 firmware PSP? Download the eLoader here to run homebrew on it!
The PSP Homebrew Database needs you! |
|
| Back to top |
|
 |
Moquette31
Joined: 03 Apr 2007 Posts: 4
|
Posted: Tue Apr 17, 2007 9:27 pm Post subject: |
|
|
Hi there, i am doing the driver for the Citipack IR-503, an IR keyboard (the only one I could found here in china).
It seems to work but I have some questions :
- in kbdkeyboards.h is IPAQ_BUTTON_CONTACTS redundant with KEY_UNKNOWN of pspirkeyb_rawkeys.h ? (the same for IPAQ_BUTTON_ITASK/KEY_INTL3)
- does these 4 defines souldn't be in pspirkeyb_rawkeys.h ?
- how can i give you my update (when i will finish debugging it;) ) ? |
|
| Back to top |
|
 |
Moquette31
Joined: 03 Apr 2007 Posts: 4
|
Posted: Tue Apr 17, 2007 11:01 pm Post subject: |
|
|
Hi, again me ;)
debugging my driver, I found a bug in keymap.c for capslock only alphas :
| Code: | | if ((raw >= KEY_A) && (raw <= KEY_Z)) |
should be replaced by :
| Code: | | if (((raw >= KEY_Q) && (raw <= KEY_P)) || ((raw >= KEY_A) && (raw <= KEY_L)) || ((raw >= KEY_Z) && (raw <= KEY_M))) |
because KEY_A to KEY_Z are not continu (cf pspirkeyb_rawkeys.h) |
|
| Back to top |
|
 |
Fanjita
Joined: 28 Sep 2005 Posts: 217
|
Posted: Thu Apr 19, 2007 7:15 am Post subject: |
|
|
Well spotted, I just committed your capslock fix to SVN.
Happy to commit any other fixes for you if you need it. _________________ Got a v2.0-v2.80 firmware PSP? Download the eLoader here to run homebrew on it!
The PSP Homebrew Database needs you! |
|
| Back to top |
|
 |
Moquette31
Joined: 03 Apr 2007 Posts: 4
|
Posted: Thu Apr 19, 2007 3:45 pm Post subject: |
|
|
great, happy to help ;)
and for this questions ?
| Moquette31 wrote: | Hi there, i am doing the driver for the Citipack IR-503, an IR keyboard (the only one I could found here in china).
It seems to work but I have some questions :
- in kbdkeyboards.h is IPAQ_BUTTON_CONTACTS redundant with KEY_UNKNOWN of pspirkeyb_rawkeys.h ? (the same for IPAQ_BUTTON_ITASK/KEY_INTL3)
- does these 4 defines souldn't be in pspirkeyb_rawkeys.h ?
- how can i give you my update (when i will finish debugging it;) ) ? |
PS : I have finish my debug, so i can send to you my update ;) |
|
| Back to top |
|
 |
J.F.
Joined: 22 Feb 2004 Posts: 2906
|
Posted: Tue May 01, 2007 8:23 pm Post subject: |
|
|
| Has the issue with the prx been looked at yet? I was playing around with my Palm 3169WW, making improvements to the Palm UW keymap, and while the lib version works, the prx version hangs before even printing a line to the display. |
|
| Back to top |
|
 |
J.F.
Joined: 22 Feb 2004 Posts: 2906
|
Posted: Sat May 05, 2007 2:26 pm Post subject: |
|
|
Okay... a few things I noticed while working on pspirkeyb.prx...
pspIrKeybReadinputPrx() is supposedly non-blocking, but on some keyboards, it is blocking. For example, on the Palm keyboard, the moment you call pspIrKeybReadinputPrx(), it blocks until you press a key. The palm function in pspirkeyb.c should look like this instead:
| Code: | static int palmuw(unsigned char* buffer, int *length)
{
unsigned char keycode=0;
unsigned int key_down=0;
unsigned char buf1;
int len;
static int pi = 0;
static unsigned char pbuf[6] = {0,0,0,0,0,0};
loop:
len = sceIoRead(g_irdafd, &buf1, 1);
if (len <= 0)
return -1;
// must be 1... can't be anything else at this point
if (pi == 0)
{
// wait on 0xff
if (buf1 == 0xff)
{
pbuf[0] = 0xff;
pi++;
}
goto loop;
}
pbuf[pi] = buf1;
pi++;
if (pi < 6)
goto loop;
pi = 0;
/* resume display */
scePowerTick(0);
//printf( "0%c - %d\n", buf[0], buf[0] );
//printf( "1%c - %d\n", buf[1], buf[1] );
//printf( "5%c - %d\n", buf[5], buf[5] );
if( pbuf[0] != 0xff || pbuf[1] != 0xc0 || pbuf[5] != 0xc1 )
return -1;
//printf( "2%c - %d\n", buf[2], buf[2] );
//printf( "3%c - %d\n", buf[3], buf[3] );
if( ( pbuf[2] + pbuf[3] ) != 0xff )
return -1;
/* 3rd pos is the key we need */
keycode = pbuf[2];
if( keycode < 128 )
key_down = 1;
else
keycode -= 128;
if ( key_down ) {
//if (debug)
//fprintf(stdout,"press %d\n", keycode);
keymap_decode( g_outputmode, palmuw_normal[keycode], KEY_PRESSED, buffer, length );
} else {
//if (debug)
//fprintf(stderr,"release %d\n", keycode);
keymap_decode( g_outputmode, palmuw_normal[keycode], KEY_RELEASED, buffer, length );
}
return 0;
} |
As far as getting the prx test working, I changed the main.c like this:
| Code: | /*
asciidemoprx: PSP IR Keyboard Library ascii demo application
(http://pspirkeyb.podzone.net)
This is the same as the ascii demo but the driver get's loaded as PRX
Copyright (C) 2007 Harald Fielker <harald.fielker@web.de>
This program can be distributed under the terms of the GNU LGPL.
See the file LICENSE.
*/
#include <pspsdk.h>
#include <pspkernel.h>
#include <pspctrl.h>
#include <pspdebug.h>
#include <psppower.h>
#include <stdio.h>
#include <string.h>
#include <pspirkeybprx.h>
#include <pspirkeyb_rawkeys.h>
#define printf pspDebugScreenPrintf
const char * g_prx_module = "ms0:/seplugins/irkeyb.prx";
/* Define the module info section */
PSP_MODULE_INFO("asciidemo", PSP_MODULE_USER, 1, 1);
/* Define the main thread's attribute value (optional) */
PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER);
/* Exit callback */
int exit_callback(int arg1, int arg2, void *common)
{
sceKernelExitGame();
return 0;
}
/* Callback thread */
int CallbackThread(SceSize args, void *argp)
{
int cbid;
cbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL);
sceKernelRegisterExitCallback(cbid);
sceKernelSleepThreadCB();
return 0;
}
/* Sets up the callback thread and returns its thread id */
int SetupCallbacks(void)
{
int thid = 0;
thid = sceKernelCreateThread("update_thread", CallbackThread, 0x11, 0xFA0, THREAD_ATTR_USER, 0);
if(thid >= 0)
{
sceKernelStartThread(thid, 0, 0);
}
return thid;
}
int main(int argc, char *argv[])
{
SceCtrlData pad;
u32 buttonsold = 0;
int kernelmode = 0; /* only 0 works for now - some keyboards need baud change */
const char *config_file = NULL; /* this will force ms0:/seplugins/pspirkeyb.ini */
SetupCallbacks();
pspDebugScreenInit();
printf("PSP Irda Keyboard test - ASCii input (PRX) \n");
sceCtrlSetSamplingCycle(0);
sceCtrlSetSamplingMode(PSP_CTRL_MODE_DIGITAL);
/* Start irkeyb.prx */
SceUID mod = pspSdkLoadStartModule(g_prx_module, kernelmode ? \
PSP_MEMORY_PARTITION_KERNEL : PSP_MEMORY_PARTITION_USER);
if(mod < 0)
{
printf( "loading of module %s failed\n", g_prx_module );
goto endprg;
}
if(pspIrKeybInitPrx( config_file, kernelmode ) != 0)
{
printf( "error: can't inialize the keyboard\n" );
printf( " check keyboard type/map in ms0:/seplugins/pspirkeyb.ini\n" );
}
else
{
unsigned char termchar = 'X';
unsigned char buffer[255];
int i, length=0;
printf("\npress %c on keyboard or any PSP button to exit\n", termchar );
/* setup output method to ASCii */
pspIrKeybOutputModePrx( PSP_IRKBD_OUTPUT_MODE_ASCII );
while(1) {
length = 0;
/* non blocking read */
if( pspIrKeybReadinputPrx(buffer, &length) >= 0 )
{
for( i=0; i < length; i++ )
printf( "%c", buffer[i] );
if( length == 1 && buffer[0] == termchar )
break;
}
else
{
sceKernelDelayThread(5*1000);
sceCtrlReadBufferPositive(&pad, 1);
if (pad.Buttons != buttonsold)
break;
}
}
/* bye keyboard */
pspIrKeybFinishPrx();
}
endprg:
printf( "\n bye... (PRESS psp button to quit)\n" );
buttonsold = 0;
while (1) {
sceCtrlReadBufferPositive(&pad, 1);
if (pad.Buttons != buttonsold) {
/* Exit */
sceKernelExitGame();
}
sceKernelDelayThread(50*1000);
}
return 0;
} |
The prx test then works (on 3.40 OE-A at least), and the Palm is unblocking.
I also made a few changes to the Palm raw codes, and made an ini for it. I'm not sure who to send it to. Who's maintaining this code? Some of the other keyboards need to be changed to be more like the Palm code above or they'll continue to block as well. |
|
| Back to top |
|
 |
Fanjita
Joined: 28 Sep 2005 Posts: 217
|
Posted: Sat May 05, 2007 5:01 pm Post subject: |
|
|
You can send changes to me if you like, although Monsti is the official owner.
I think Monsti had more or less abandoned the PRX flavour, and my interest is much more in using piKey as a more generic library, than using the lib as a PRX, but I'm happy to help you keep it updated if you want to work with the PRX. _________________ Got a v2.0-v2.80 firmware PSP? Download the eLoader here to run homebrew on it!
The PSP Homebrew Database needs you! |
|
| Back to top |
|
 |
J.F.
Joined: 22 Feb 2004 Posts: 2906
|
Posted: Sun May 06, 2007 5:37 am Post subject: |
|
|
| Fanjita wrote: | You can send changes to me if you like, although Monsti is the official owner.
I think Monsti had more or less abandoned the PRX flavour, and my interest is much more in using piKey as a more generic library, than using the lib as a PRX, but I'm happy to help you keep it updated if you want to work with the PRX. |
Sounds like a plan. Should I try to "unblock" some of the other keyboard drivers first? I just did the Palm one because that's what I have.
The PRX seems to be handy for times when you just need keyboard input that is independent of the build and doesn't require flashing. Just drop it and a couple ini files into seplugins and you're set. I'll probably use the PRX for keyboard support on some of the projects on my todo list.
EDIT: I noticed over at MaxConsole a couple reports that pikey doesn't work on 3.40 OE-A. I suppose you're looking into that... |
|
| Back to top |
|
 |
Fanjita
Joined: 28 Sep 2005 Posts: 217
|
Posted: Mon May 07, 2007 2:30 am Post subject: |
|
|
| J.F. wrote: | Sounds like a plan. Should I try to "unblock" some of the other keyboard drivers first? I just did the Palm one because that's what I have.
|
I suspect the others are OK, your fix to the palm is the same I think as one that went into the non-PRX code - I hadn't expected it to be needed in both places, haven't really looked at the PRX code myself since it was supposed to be a bit broken already.
| Quote: | | The PRX seems to be handy for times when you just need keyboard input that is independent of the build and doesn't require flashing. Just drop it and a couple ini files into seplugins and you're set. I'll probably use the PRX for keyboard support on some of the projects on my todo list. |
The piKey lib works that way too, and (at the risk of self-promotion) I'd recommend it because it also gives you free support for e.g. SIO terminal input, etc. Check out the sample code in the piKey package for how to use it, it will autoload the PRX if it isn't already running.
| Quote: | | EDIT: I noticed over at MaxConsole a couple reports that pikey doesn't work on 3.40 OE-A. I suppose you're looking into that... |
Not actively, I have no time at the moment sadly, but it is top of the to-do list. _________________ Got a v2.0-v2.80 firmware PSP? Download the eLoader here to run homebrew on it!
The PSP Homebrew Database needs you! |
|
| Back to top |
|
 |
J.F.
Joined: 22 Feb 2004 Posts: 2906
|
Posted: Mon May 07, 2007 5:55 am Post subject: |
|
|
| Fanjita wrote: | | J.F. wrote: | Sounds like a plan. Should I try to "unblock" some of the other keyboard drivers first? I just did the Palm one because that's what I have.
|
I suspect the others are OK, your fix to the palm is the same I think as one that went into the non-PRX code - I hadn't expected it to be needed in both places, haven't really looked at the PRX code myself since it was supposed to be a bit broken already. |
The fix was in the main lib, not the prx code. When you called the function to read the keyboard buffer, it's supposed to exit if there's no keys, but the Palm driver (and hama driver) instead sit in a loop waiting for all the bytes of a key packet to come in before exiting, even if a packet hasn't started yet. Once you enter the function, you don't leave until a key comes.
Look at the first code in both (in libpspirkeyb/pspirkeyb.c):
| Code: | while (i < 6 || z < 6) {
...
while (i < 5 || z < 5)
{ |
Neither one will exit until a) all 6/5 bytes come in, or b) an error occurs in reading the irda (note that reading the irda when no bytes have been received is not an error). So both of those keyboards block... well, the Palm doesn't with my code anymore. I think I should change the hama code before I send it. The others look okay, but I'm leary about some code in a few others:
| Code: | if( sceIoRead(g_irdafd, buf, 2) != 2 )
return (-1); |
That won't block, but suppose it just happens to get called when one byte has been received, but not the second in the packet... the first byte will be discarded by the read, then the second by the next read. If another packet has come in by the next call, it's first byte will wind up read as the second byte of the packet. So doing the code above has a race condition when you hit the keys: will it receive both bytes before you poll the lib? If not, it'll at least miss one key, possibly miss two keys, or return garbage and miss the next key. Given the low baud rate of these keyboards, it's probably a higher risk than people think.
| Quote: | | Quote: | | The PRX seems to be handy for times when you just need keyboard input that is independent of the build and doesn't require flashing. Just drop it and a couple ini files into seplugins and you're set. I'll probably use the PRX for keyboard support on some of the projects on my todo list. |
The piKey lib works that way too, and (at the risk of self-promotion) I'd recommend it because it also gives you free support for e.g. SIO terminal input, etc. Check out the sample code in the piKey package for how to use it, it will autoload the PRX if it isn't already running. |
Does pikey work from the memstick alone? You don't have to flash it? That isn't clear in the docs. I guess I'll compile it with my code and copy it over and try it. If that's the case, I'll stick to pikey for my homebrew keyboard usage. :)
| Quote: | | Quote: | | EDIT: I noticed over at MaxConsole a couple reports that pikey doesn't work on 3.40 OE-A. I suppose you're looking into that... |
Not actively, I have no time at the moment sadly, but it is top of the to-do list. |
Okay. Just wanted to be sure you knew of the reports. Since I have 3.40 OE on my PSP, it's made me a bit leary of flashing pikey. If I spot anything that might be related while going through the code, I'll let you know. |
|
| Back to top |
|
 |
gringo
Joined: 08 May 2007 Posts: 12
|
Posted: Fri May 11, 2007 9:08 pm Post subject: |
|
|
Hi
I think it would be nice if there were some kind of wizard in which you press the keyboard buttons and then manually map it in the wizard on a specific key. Just an idea. I haven't read all the thread ... but ...ye
gringo |
|
| Back to top |
|
 |
J.F.
Joined: 22 Feb 2004 Posts: 2906
|
Posted: Sat May 12, 2007 10:24 am Post subject: |
|
|
| At the moment, there's an file that handles the mapping of ir keys -> PSP buttons. Just edit it with a text editor. It's the ms0:/seplugins/pikey/ctrlmap.txt file. |
|
| Back to top |
|
 |
futaris
Joined: 28 Dec 2005 Posts: 45
|
Posted: Sun Jun 03, 2007 5:38 pm Post subject: |
|
|
| Ok, rev 2211 has the new code for hama. How can I get read/write access to SVN to check in my changes for Stowaway XT? |
|
| Back to top |
|
 |
J.F.
Joined: 22 Feb 2004 Posts: 2906
|
Posted: Mon Jun 04, 2007 6:39 am Post subject: |
|
|
| futaris wrote: | | Ok, rev 2211 has the new code for hama. How can I get read/write access to SVN to check in my changes for Stowaway XT? |
I sent my changes to fanjita (at his request) and he said he'd update the svn. |
|
| Back to top |
|
 |
|