Pikey/pspIRkeyb mod - work in progress

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

Moderators: cheriff, TyRaNiD

User avatar
jean
Posts: 489
Joined: Sat Jan 05, 2008 2:44 am

Pikey/pspIRkeyb mod - work in progress

Post by jean »

If you're interested in pikey, or in keboards on psp in general, I hope you have noticed openKeyboard Project, or at least the "any ps2 keyboard to psp adapter" i posted months ago. While the definitive firmware for chatpad is being developed day by day (current 0.3 is fully functional, anyway), i left untouched the psp-side of the project for a while. So, i decided not to reinvent the wheel and put my hands on pikey 0.4 sources as well as pspIRkeyb (don't know what version i'm compiling...). The problem is: everything compiles well (a little modification in hblib_sample's makefile was required) but my PSP freezes soon after the "pikey is found RUNNING" string appears. I have to say it's the first time i work on 3.90 M33, and there are some things i don't understand; all my previous code is running, but i never tried VSH plugin: does nids resolver work only for eboots? Or it is used for vsh plugin prxes as well -and hence i can forget about it?? Maybe i screwed up something in compilation or the code itself needs some tweaks? I know that i could find some of the answer myself, but my free time is very little, and some advices could lend to a fast release of a pikey compatible with newer sio keyboard projects (doesn't this interest you, SLIM owners?) ....at least i hope i proved i'm not an "app requesting noob" ... :)

jean
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

Get pspirkeyb working first... use the sample code in the pspirkeyb directory to test it. Don't worry about pikey until that is working.
User avatar
jean
Posts: 489
Joined: Sat Jan 05, 2008 2:44 am

Post by jean »

Get pspirkeyb working first
Ok, i will do so....i was first looking at pikey sources because it is already capable of handling sio I/O, while pspIRkeyb appears to be not. Anyway, after a little, quick and superficial code investigation i found pikey doing realtime syscall patch using a function that retrieve system functions by nid....haven't look further, but i guess this nid have to be hardcoded as a constant, and then a nid resolver cannot handle such a situation... i need to drill down nids related techniques... Again, ANY suggestion will be appreciated
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

Pikey gets its keyboard inputs via pspirkeyb. As far as I've seen in the code, the SIO is limited to optional debug output, which is disabled in the final build in any case. While pikey was designed to be flexible about modules, nothing was ever done more than simply getting pspirkeyb key codes. What makes pikey so popular are the OUTPUT modules - where you can simulated buttons, the analog stick, and type in the OSK.
User avatar
jean
Posts: 489
Joined: Sat Jan 05, 2008 2:44 am

Post by jean »

Uhmmm....no! Pikey is not utilizing pspIRkeyb to get code from SIO....there's a special module "piKeySio.prx" for it....in piKeySio.c you can find:

Code: Select all

.
.
.
int main_thread(SceSize args, void *argp) {
	int ch;

	sioPrint("SIO in ready.\r\n");

	for(;;) {	
		ch = pspDebugSioGetchar();

		if(ch > 0)
		{
			putNextCharW(ch);
		}

    sceKernelDelayThread(1000);
	}
	return 0;
}
.
.
.
where that putNextCharW is injecting code in the char buffer. Aside from the fact that i should put some kind of read buffer like i've done in the "official" sio driver, i don't understand the choice to make a module inject data instead of simply exporting a poll function that main module could call to see if something happened...I'm fanatic about design patterns, and really don't catch it. Anyway, it's true... even if it can read from SIO, it appears to be nothing but a debug code, but chatpad could already work with it in "serial mode". Obviously i would like to make chatpad work in "scan mode" to handle repeats, etc... and i would like to add the code that turns speakers on again if a sio keyboard is detected. I managed to find a couple of compile-time-stated nids that appear to be wrong in hblib/pikeylib.c and in osk_out/oskout.c but i still need to get into the nids story. A little side note on the "popular" output method on OSK....i feel it very dirty. OSK is summoned by a function and questioned for status by another function: what's so difficult about hooking THAT functions?
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

Yes, but compare that to the ir main loop - it doesn't even bother trying to translate the serial from whatever into pikey format. It's clearly just a debugging tool, or perhaps just a skeleton that was never fleshed out since there was never a need for it. You either need to redo the SIO input module completely, or remove it and rely on pspirkeyb.

As to the structure of pikey - you'd have to ask fanjita about that. :) The limit of my work on pikey is updating pspirkeyb and adding some messages to certain states.
angelo
Posts: 168
Joined: Wed Aug 29, 2007 9:34 pm

SIO Should work

Post by angelo »

SIO should still work Joseph. It actually works on the Slim in 3.60 M33. The NIDs need to be added to the resolver as it stopped working in kernel 3.71+.

A few requests have been made to get it working again but I just told them that we're working on getting everything working again after the NID resolver storm!
User avatar
jean
Posts: 489
Joined: Sat Jan 05, 2008 2:44 am

Post by jean »

PrxTooling around I found some wrong nid in my pikey.prx, and obviously _I _ introduced them (my toolchain is Frankenstein's creature... :) ) I've almost done it! Gimme just the time to update my dev tools and a "piKeyChatPad_In.prx" will be released as well.... in the meanwhile i'm looking at pspIrKeyb like J.F. suggested, even if i think that something called *IR*.* should be kept separate from other input method...nowadays, pspIrKeyb is synonimous to "keyboard input" and everyone uses it, so putting SIO input in pspIrKeyb would help spread that device's support, but i think devs should migrate to piKey, indeed = more flexibility, no static linking, pspIrKeyb support still available. Anyway, pikey should -no doubt- be improved as well. Angelo, if i don't misunderstand, you'r developing unofficial 0.4 version....feel free to contact me if you think we should work togheter.
User avatar
jean
Posts: 489
Joined: Sat Jan 05, 2008 2:44 am

AAARGHHH

Post by jean »

Surely there's something very stupid i'm doing, but i'm going mental trying to find it!!
Here's what i've done:
  • updated toolchain and sdk (now i'm using heimdall's 0.6 for win32)
    placed fw_version = 390 in all makefiles
    make sure all prx are in kernel mode
    for all prx checked exported functions
    surrounded all exported functions with the k1 stuff
    checked compile-time constants for hooked functions' nids
The sample application works (with some filcker flaws) under 150 kernel, but i didn't managed to make pikey.prx work as a plugin in vsh mode under 390 kernel: it freezes my PSP BEFORE splash screen and BEFORE being able to put ANY debug string on my sio terminal. Here follow the output of pikey's sample and that of prxtool launched on my compiled pikey.prx:

pikey's sample debug output:

Code: Select all

 Valid

  -----------------------
  -- piKey is starting --
  -----------------------

Freemem: 01 = 00084F00
Freemem: 02 = 017FC000
Freemem: 03 = 00084F00
Freemem: 04 = 00100000
Freemem: 05 = 00400000
Freemem: 06 = 017FC000Wait for module sceVshBridge_Driver: ............TIMEOUT.
Detected GAME mode
Load drivers from ms0:/seplugins/pikey/inputdrivers
ms0:/seplugins/pikey/inputdrivers/piKeySIO.PRX:
Check : 'piKeyIR.PRX'
SIO in ready.
Unrecognised vt100 code
vt100: 00=> FFFFFFFF : 00
Started.
modulemgr.c:sceKernelQueryModuleInfo:(modid 0x03b27a1b, pInfo 0x882fe01c), size=0x00000060
modulemgr.c:sceKernelQueryModuleInfo:new version
Successfully loaded driver 'SIO' version 1
alloced blockID: 03B31E55 size 0000004C
ms0:/seplugins/pikey/inputdrivers/piKeyIR.PRX:
Check : 'piKeyIR.PRX'
Skip piKeyIR.PRX - disabled module
Load drivers from ms0:/seplugins/pikey/outputdrivers
ms0:/seplugins/pikey/outputdrivers/piKeyCTRLOut.PRX:
Check : 'piKeyIR.PRX'
Wait for module sceController_Service: OK.
Return hookid 00
Return hookid 01
Return hookid 02
Return hookid 03
configOpen: ms0:/seplugins/pikey/ctrlmap.txt
alloced blockID: 03B27243 size 0000072D
Read the file
Close the file
UP(00000067) = UP(00000010)
DOWN(0000006C) = DOWN(00000040)
LEFT(00000069) = LEFT(00000080)
RIGHT(0000006A) = RIGHT(00000020)
ENTER(0000001C) = CONFIRM(FFFF0000)
ESC(00000001) = CANCEL(0000FFFF)
Z(0000002C) = TRIANGLE(00001000)
X(0000002D) = SQUARE(00008000)
MINUS(0000000C) = LTRIGGER(00000100)
EQUAL(0000000D) = RTRIGGER(00000200)
E(00000012) = HOME(00010000)
Q(00000010) = HOME(00010000)
TAB(0000000F) = SELECT(00000001)
SPACE(00000039) = START(00000008)
H(00000023) = HELP(00FFFF00)
W(00000011) = ANALOG_UP(F0000001)
S(0000001F) = ANALOG_DOWN(F0000002)
A(0000001E) = ANALOG_LEFT(F0000003)
D(00000020) = ANALOG_RIGHT(F0000004)
configRead: Invalid config handle
Valid handle
Free blockID: 03B27243
CTRL out ready.
Started.
modulemgr.c:sceKernelQueryModuleInfo:(modid 0x03b1ef47, pInfo 0x882fe01c), size=0x00000060
modulemgr.c:sceKernelQueryModuleInfo:new version
Successfully loaded driver 'CTRL' version 1
alloced blockID: 03B27261 size 0000004C
ms0:/seplugins/pikey/outputdrivers/piKeyDanzeffOut.PRX:
Check : 'piKeyIR.PRX'
Wait for module sceController_Service: OK.
Copy hook record from number 00
Return hookid 04
Copy hook record from number 01
Return hookid 05
Copy hook record from number 02
Return hookid 06
Copy hook record from number 03
Return hookid 07
DANZEFF out ready.
Started.
modulemgr.c:sceKernelQueryModuleInfo:(modid 0x03b1617d, pInfo 0x882fe01c), size=0x00000060
modulemgr.c:sceKernelQueryModuleInfo:new version
Successfully loaded driver 'DANZEFFOUT' version 1
alloced blockID: 03B1E44B size 0000004C
ms0:/seplugins/pikey/outputdrivers/piKeyOSKOut.PRX:
Check : 'piKeyIR.PRX'
Wait for module sceController_Service: OK.
Copy hook record from number 04
Return hookid 08
Copy hook record from number 05
Return hookid 09
Copy hook record from number 06
Return hookid 0A
Copy hook record from number 07
Return hookid 0B
configOpen: ms0:/seplugins/pikey/pikeyconfig.txt
alloced blockID: 03B0EB55 size 000008AB
Read the file
Close the file
Valid handle
Free blockID: 03B0EB55
OSK out ready.
Started.
modulemgr.c:sceKernelQueryModuleInfo:(modid 0x03b2ff59, pInfo 0x882fe01c), size=0x00000060
modulemgr.c:sceKernelQueryModuleInfo:new version
Successfully loaded driver 'OSK' version 1
alloced blockID: 03B26173 size 0000004C
--- All plugins loaded ---
vt100: 71=> 00000010 : 00
Keypress: 00000010 00000000
Keyrelease: 00000010 00000000
vt100: 77=> 00000011 : 00
Keypress: 00000011 00000000
Keyrelease: 00000011 00000000
vt100: 65=> 00000012 : 00
Keypress: 00000012 00000000
Keyrelease: 00000012 00000000
vt100: 72=> 00000013 : 00
Keypress: 00000013 00000000
Keyrelease: 00000013 00000000
vt100: 74=> 00000014 : 00
Keypress: 00000014 00000000
Keyrelease: 00000014 00000000
vt100: 79=> 00000015 : 00
Keypress: 00000015 00000000
Keyrelease: 00000015 00000000
Esc: table 00
vt100: 1B=> FFFFFFFF : 00
Keypress: 00000001 00000000
---boot phase--- 03
--- Exiting piKey ---
---boot phase--- 02
---boot phase--- 01
---boot before---

and here's pikey.prx analysis done with prxtool:

Code: Select all

prxtool -f pikey.prx
PRXTool v1.1 : (c) TyRaNiD 2k6
Built: Oct 24 2007 20:17:36
Loaded PRX pikey.prx successfully
Module information

Name:    piKey
Attrib:  1006
Version: 1.1
GP:      0000EF60

Exports:
Export 0, Name syslib, Functions 5, Variables 1, flags 80000000
Functions:
0xD632ACDB [0x00000D74] - module_start
0xCEE8593C [0x0000126C] - module_stop
0xD3744BE0 [0x00001248] - module_bootstart
0x2F064FA6 [0x00001224] - module_reboot_before
0xADF12745 [0x000011BC] - syslib_ADF12745
Variables:
0xF01D73A7 [0x00004370] - module_info
Export 1, Name piKey, Functions 31, Variables 0, flags 00010000
Functions:
0xD0E7CB6B [0x00001558] - piKey_D0E7CB6B
0x6B8271AF [0x00001774] - piKey_6B8271AF
0x9A95A90A [0x00000700] - piKey_9A95A90A
0x468C4E8E [0x000005BC] - piKey_468C4E8E
0x5F885EF8 [0x00000C5C] - piKey_5F885EF8
0x594E2B81 [0x000007D4] - piKey_594E2B81
0xCAA74642 [0x000008E4] - piKey_CAA74642
0xA8FBA87D [0x00001158] - piKey_A8FBA87D
0xC2054929 [0x00001074] - piKey_C2054929
0x6B0C5C80 [0x000010E8] - piKey_6B0C5C80
0x1BA7AE4B [0x00002558] - piKey_1BA7AE4B
0x43C336E4 [0x00000928] - piKey_43C336E4
0x938AA16D [0x00000518] - piKey_938AA16D
0x7111D3E1 [0x00000BB4] - piKey_7111D3E1
0x4ED59445 [0x00003370] - piKey_4ED59445
0x952E87D9 [0x00002F98] - piKey_952E87D9
0xEA5590DA [0x00002E40] - piKey_EA5590DA
0x4010A60E [0x00000308] - piKey_4010A60E
0x6FBCD3B0 [0x00000180] - piKey_6FBCD3B0
0x4D030AAE [0x000024D4] - piKey_4D030AAE
0x855C25D3 [0x00000128] - piKey_855C25D3
0x6B4DB528 [0x000017B4] - piKey_6B4DB528
0x5C8C7762 [0x000009E4] - piKey_5C8C7762
0x2B458D3E [0x00000AEC] - piKey_2B458D3E
0xEF569072 [0x00000154] - piKey_EF569072
0xA833D884 [0x00000478] - piKey_A833D884
0x70615273 [0x000003B8] - piKey_70615273
0xB77C964A [0x00000224] - piKey_B77C964A
0x8B851CAA [0x00001C8C] - piKey_8B851CAA
0x8E1D5291 [0x00001298] - piKey_8E1D5291
0x20C74C84 [0x00001A98] - piKey_20C74C84

Imports:
Import 0, Name sceDisplay_driver, Functions 3, Variables 0, flags 00010000
Functions:
0xDEA197D4 [0x000040C4] - sceDisplay_driver_DEA197D4
0xEEDA2E54 [0x000040CC] - sceDisplay_driver_EEDA2E54
0x984C27E7 [0x000040D4] - sceDisplay_driver_984C27E7
Import 1, Name sceCtrl_driver, Functions 1, Variables 0, flags 00010000
Functions:
0x3A622550 [0x000040DC] - sceCtrl_driver_3A622550
Import 2, Name KDebugForKernel, Functions 2, Variables 0, flags 00010000
Functions:
0xE146606D [0x000040E4] - KDebugForKernel_E146606D
0xD636B827 [0x000040EC] - KDebugForKernel_D636B827
Import 3, Name LoadCoreForKernel, Functions 2, Variables 0, flags 00010000
Functions:
0xCF8A41B1 [0x000040F4] - LoadCoreForKernel_CF8A41B1
0xCCE4A157 [0x000040FC] - LoadCoreForKernel_CCE4A157
Import 4, Name IoFileMgrForKernel, Functions 8, Variables 0, flags 00010000
Functions:
0x810C4BC3 [0x00004104] - IoFileMgrForKernel_810C4BC3
0x109F50BC [0x0000410C] - IoFileMgrForKernel_109F50BC
0x6A638D83 [0x00004114] - IoFileMgrForKernel_6A638D83
0x42EC03AC [0x0000411C] - IoFileMgrForKernel_42EC03AC
0x68963324 [0x00004124] - IoFileMgrForKernel_68963324
0xB29DDF9C [0x0000412C] - IoFileMgrForKernel_B29DDF9C
0xE3EB004C [0x00004134] - IoFileMgrForKernel_E3EB004C
0xEB092469 [0x0000413C] - IoFileMgrForKernel_EB092469
Import 5, Name sceSysreg_driver, Functions 1, Variables 0, flags 00010000
Functions:
0x7FD7A631 [0x00004144] - sceSysreg_driver_7FD7A631
Import 6, Name UtilsForKernel, Functions 2, Variables 0, flags 00090000
Functions:
0x34B9FA9E [0x0000414C] - UtilsForKernel_34B9FA9E
0xC2DF770E [0x00004154] - UtilsForKernel_C2DF770E
Import 7, Name sceSyscon_driver, Functions 1, Variables 0, flags 00010000
Functions:
0x44439604 [0x0000415C] - sceSyscon_driver_44439604
Import 8, Name ThreadManForKernel, Functions 10, Variables 0, flags 00010000
Functions:
0xC11BA8C4 [0x00004164] - ThreadManForKernel_C11BA8C4
0x278C0DF5 [0x0000416C] - ThreadManForKernel_278C0DF5
0xCEADEB47 [0x00004174] - ThreadManForKernel_CEADEB47
0xD6DA4BA1 [0x0000417C] - ThreadManForKernel_D6DA4BA1
0x3F53E640 [0x00004184] - ThreadManForKernel_3F53E640
0x4E3A1105 [0x0000418C] - ThreadManForKernel_4E3A1105
0x446D8DE6 [0x00004194] - ThreadManForKernel_446D8DE6
0xF475845D [0x0000419C] - ThreadManForKernel_F475845D
0x809CE29B [0x000041A4] - ThreadManForKernel_809CE29B
0x293B45B8 [0x000041AC] - ThreadManForKernel_293B45B8
Import 9, Name SysclibForKernel, Functions 8, Variables 0, flags 00010000
Functions:
0x476FD94A [0x000041B4] - SysclibForKernel_476FD94A
0x0D188658 [0x000041BC] - SysclibForKernel_0D188658
0xC0AB8932 [0x000041C4] - SysclibForKernel_C0AB8932
0xEC6F1CF2 [0x000041CC] - SysclibForKernel_EC6F1CF2
0xB49A7697 [0x000041D4] - SysclibForKernel_B49A7697
0x52DF196C [0x000041DC] - SysclibForKernel_52DF196C
0x10F3BB61 [0x000041E4] - SysclibForKernel_10F3BB61
0x7661E728 [0x000041EC] - SysclibForKernel_7661E728
Import 10, Name SysMemForKernel, Functions 5, Variables 0, flags 00010011
Functions:
0xE6581468 [0x000041F4] - SysMemForKernel_E6581468
0x237DBD4F [0x000041FC] - SysMemForKernel_237DBD4F
0xB6D61D02 [0x00004204] - SysMemForKernel_B6D61D02
0x9D9A5BA1 [0x0000420C] - SysMemForKernel_9D9A5BA1
0x3FC9AE6A [0x00004214] - SysMemForKernel_3FC9AE6A
Import 11, Name ModuleMgrForKernel, Functions 3, Variables 0, flags 00010000
Functions:
0x977DE386 [0x0000421C] - ModuleMgrForKernel_977DE386
0x50F0C1EC [0x00004224] - ModuleMgrForKernel_50F0C1EC
0x748CBED9 [0x0000422C] - ModuleMgrForKernel_748CBED9
Import 12, Name sceHprm_driver, Functions 1, Variables 0, flags 00010000
Functions:
0x588845DA [0x00004234] - sceHprm_driver_588845DA
Done
jube
Posts: 115
Joined: Tue Oct 23, 2007 2:26 am

Post by jube »

hi guys, internet's been down so just back!!
Am also working on this, but
1) am very much a noob compared to you guys !!
2) Have just had a pretty searious computer crash so in process of putting systems back together

But for record, pikey framework and everything else EXCEPT the serial debug output lines work on a 3.9 slim, installer does not work but can simply install by hand when i worked out what the installer code was doing.

I am integrating the sio driver by launching the sio prx from the framework ( in same,ish manner as the other pikey modules are launched ) then inporting the serial steam ( the prx is modified to export to the framework, ie the sio driver is now a pikey input module ASWELL), its a bit of a job but might work?
User avatar
jean
Posts: 489
Joined: Sat Jan 05, 2008 2:44 am

Post by jean »

Ok, but answer the question: how? what is your sdk? what you changed in code or makefiles? are your nids same as mine? Adding a SIO prx is a piece of cake to code: the part i'm stuck is compiling everything for 390 (and make it work on 390 as a vsh plugin) so i can begin trying to hook directly OSK libraries instead of simulating keypresses...
jube
Posts: 115
Joined: Tue Oct 23, 2007 2:26 am

Post by jube »

AH!
I think the sdk is part of your current problem, i have tried the win_32 version of the sdk and as JF points out a lot of code written on linux ( the default platform round here ) is not going to compile "out the box ", "/" vs "\" , case sensitivity vs no case, changing environ variables etc... the list goes on !, for me who wants to take full advantage of all the cool work round here without a lot of extra grief, had to go "native" ( ubuntu ).
Being good with apps i can recomend following ( from very grim experience !! )

If you want to stick to a win environ, use vbox ( google it ) to run a virual linux machine from win desktop, use vbox!!! all the others use running tasks ( frigin hate that !!, ) vbox uses drivers WAY COOLER !!!

Otherwise dual boot your machine with ubuntu doing the booting, again google for instructions

Setup the sdk and do compiling in the linux environ, use the win_32 6.7 gdb and insight ( part of devkitpro) from win to do debugging, along with the ps2dev winn32 psplink.

nids etc just not a problem, the thing works, compiles,links etc... all perfectly in cygwin or linux sdk, have messed a bit myself so know :)

Finally if your on this mate i think will let you at it !!!!, your way ahead of me in psp department. I will just adapt your work for my touch screen :) :)

irkbd should also be addapted, as a seperate project, there is no better way of getting chatpad integrated into all the current coolest apps ( again as jf pointed out ), and for that purpose hooking of the xmb functions is irrelevent.
User avatar
jean
Posts: 489
Joined: Sat Jan 05, 2008 2:44 am

*#?!!!?***@@°à#...

Post by jean »

...if something is going wrong, that is on nids or flags side, because I CAN compile, and the whole thing _works_ in 150 kernel... I will risk to look like a complete noob, but i have to say i was not able to find a list of 390 nids (silverspring's site is stuck on 3.80...are they all the same??) and i'm currently seeing if a nid is correct or not just seeking in a list (without function names) i made prxdecrypt-ing and pxrtool-ing the whole 3.90 custom firmware. Fix_import always tells me he has nothing to do with my elfs (and, again, i was not able to find a fix_import map file specifically intended for 3.90).
PS: with either PSP_FW_VERSION=390 or PSP_FW_VERSION=whatTheHellYouLike my sdk is outputting EXACTLY the same things...is it an SDK issue or i'm missing something fundamental??
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Re: *#?!!!?***@@°à#...

Post by J.F. »

jean wrote:...if something is going wrong, that is on nids or flags side, because I CAN compile, and the whole thing _works_ in 150 kernel... I will risk to look like a complete noob, but i have to say i was not able to find a list of 390 nids (silverspring's site is stuck on 3.80...are they all the same??) and i'm currently seeing if a nid is correct or not just seeking in a list (without function names) i made prxdecrypt-ing and pxrtool-ing the whole 3.90 custom firmware. Fix_import always tells me he has nothing to do with my elfs (and, again, i was not able to find a fix_import map file specifically intended for 3.90).
PS: with either PSP_FW_VERSION=390 or PSP_FW_VERSION=whatTheHellYouLike my sdk is outputting EXACTLY the same things...is it an SDK issue or i'm missing something fundamental??
Pikey works by looking up certain functions using the NIDs so that they can be hooked. I imagine that one or more of these NIDs are not getting translated by the NID resolver when the function is looked up. You can find these NIDs in ctrlout.c:

Code: Select all

MainHook mainHookSave[] =
{
	{ 0, "sceVshBridge_Driver",   "sceVshBridge", 0xc6395c03, vshCtrlReadBufferPositiveFake, 1 },
	{ 0, "sceController_Service", "sceCtrl",      0x1F803938, sceCtrlReadBufferPositiveFake, 0 },
	{ 0, "sceController_Service", "sceCtrl",      0x3A622550, sceCtrlPeekBufferPositiveFake, 0 },
	{ 0, "sceController_Service", "sceCtrl",      0x60B81F86, sceCtrlReadBufferNegativeFake, 0 },
	{ 0, "sceController_Service", "sceCtrl",      0xC152080A, sceCtrlPeekBufferNegativeFake, 0 },
	{ 0, "", "", 0, NULL }
};
All but one are kernel mode functions that changed in 3.71 (and may be changed with every rev after 3.71).
User avatar
jean
Posts: 489
Joined: Sat Jan 05, 2008 2:44 am

Post by jean »

First thing i checked...looking into my big NID mess each of those NID was present, but i begin to think this is not a good method...again: does a nid list up to date exist?
User avatar
jean
Posts: 489
Joined: Sat Jan 05, 2008 2:44 am

Post by jean »

I tryed to make pikey.prx start without ANY input/output module loading because hooks are performed in these modules and not in pikey.prx itself....result? It keeps freezing my psp. Now it's a matter of honor. Just to avoid wasting my and your time, i think i could focus on plugin prxes...jube, can you send me your working 3.9 version of pikey.prx compiled?? I wanna check some clues and start working on the real need - that's a couple of plugin (input from chatpad or other serial adapters and output with direct hooks to OSK)
jube
Posts: 115
Joined: Tue Oct 23, 2007 2:26 am

Post by jube »

Sure will do tomorrow mate :) my systems almost back online propper, but to save time have you tried running pikey with debug option OFF. That disables the sio output call in pikey, since that call also freezes my psp on startup ( debung= on = freeze, debug=off=working correct ), strangly the sio input module sio-in call causes no freeze, but since it does not power the port have not been able to check function ( whats the point has to be re-written anyway !! ).
User avatar
jean
Posts: 489
Joined: Sat Jan 05, 2008 2:44 am

something is moving on

Post by jean »

have you tried running pikey with debug option OFF
Uh...yeah you could definitely be right (even if i can't figure out WHY)....i was wondering of this since you said
pikey framework and everything else EXCEPT the serial debug output lines work on a 3.9 slim
....will surely try this, thanks. Anyway if you can send me your compiled, it will be nice (just in case)...

jean
User avatar
jean
Posts: 489
Joined: Sat Jan 05, 2008 2:44 am

OOOOOKKKKK!!!

Post by jean »

Ok, removing debug SIO output all works fine (I JUST TRIED CHATPAD WITH IT!!! i already love it)....the hard part is that i would like to make chatpad's protocol bidirectional (to turn on individual lights or store config...) and hence i should WRITE instead of just read.... stay tuned.
jube
Posts: 115
Joined: Tue Oct 23, 2007 2:26 am

Post by jube »

you need to fully integrate your sio prx, and keep it as a driver prx, in case other modules need to acess the sio aswell ( time slicing the serial stream for example ), glad a noob could help :)
Please post your code when done and while developing ? I assume you dont want my compiled version now ?
User avatar
jean
Posts: 489
Joined: Sat Jan 05, 2008 2:44 am

Post by jean »

PS: @jube:
I was beginning to develop a complex SIO system to allow one writer/multiple readers, to satisfy your request, but then i wondered: why?
I think it's better to only signall other plugins that SIO is in use by someone, because if you are hardware multiplexing serial streams, you have to create your own grammar to merge the two data streams and software endpoint of such a communication has to know it. In other words, if i understood well, you're doing something very specific that requires a specific software, so utilize sio as you wish without having care of what the other plugins are doing (it is the user who have to know that he cannot install two plugins operating on the same port). The only thing that we should care about is that user could wish to suspend SIO port utilization during the execution of certain homebrew (let's say deniska's mapThis needing sio port to read GPS data). So if someone wants to help me, we should gather info on:
1) how to detect if some code is requesting SIO port
2) what's the better way to modify pikey to allow a fair SIO usage (an exported function from pikey like "pikeyIsSIOUsed()" and one exported from module llike "needsSIOPort()")
3) what's the better way to decide if speakers should be forced on/off
User avatar
jean
Posts: 489
Joined: Sat Jan 05, 2008 2:44 am

Post by jean »

Ok... this is how it's going on: i replaced the SIO out with a log-to-file debug system. Pikey is fully functional in 390 environment, BUT i'm trying to develop it further. Instead of simulating keypresses when in OSK mode, i'm trying to completely replace OSK....to do so i hooked OSK functions

Code: Select all

int sceUtilityOskInitStart(SceUtilityOskParams* params);
int sceUtilityOskShutdownStart(void);
int sceUtilityOskUpdate(int n);
int sceUtilityOskGetStatus(void);
replecing them with

Code: Select all

int sceUtilityOskInitStart_Hook(SceUtilityOskParams* params)
{
	jLog("* called sceUtilityOskInitStart\r\n");

	// sioResetFBuf(); // cursor on start
	unsigned char test[128]   = { 'O','S','K',' ','H','o','o','k',' ','T','e','s','t', 0 }; // test string to place in outtext
	unsigned char * p = (unsigned char *)params->data->outtext;
	
	int len = params->data->outtextlength;
	
	int i=0;
	while &#40;test&#91;i&#93; && i<len&#41;
	&#123;
		*p = test&#91;i&#93;;
		p++;
		i++;
	&#125;
	*p = 0; // terminate string
	
	return 0; // all OK!
&#125;

int sceUtilityOskShutdownStart_Hook&#40;void&#41;
&#123;
	jLog&#40;"* called sceUtilityOskShutdownStart\r\n"&#41;;
	// ignore for now	
	return 0; // all OK!
&#125;

int sceUtilityOskUpdate_Hook&#40;int n&#41;
&#123;
	jLog&#40;"* called sceUtilityOskUpdate\r\n"&#41;;
	// ignore for now
	return 0; // all OK!
&#125;

int sceUtilityOskGetStatus_Hook&#40;void&#41;
&#123;
	jLog&#40;"* called sceUtilityOskGetStatus\r\n"&#41;;
	return PSP_UTILITY_DIALOG_FINISHED;
&#125;
with the "apiHookByNid" function exported by main pikey body.
My log file says everything goes ok in patching, but then none of the "fake" functions get called when OSK is summoned.
Here are the nids i'm using, i found them prxtooling around on an osk_usage_sample and on my UTILITY.PRX:

Code: Select all

	&#123; 0, "sceUtility_Driver", "sceUtility",		0xF6269B82, sceUtilityOskInitStart_Hook, 1 &#125;,
	&#123; 0, "sceUtility_Driver", "sceUtility",		0x3DFAEBA9, sceUtilityOskShutdownStart_Hook, 1 &#125;,
	&#123; 0, "sceUtility_Driver", "sceUtility",		0x4B85C861, sceUtilityOskUpdate_Hook, 1 &#125;,
	&#123; 0, "sceUtility_Driver", "sceUtility",		0xF3F76017, sceUtilityOskGetStatus_Hook, 1 &#125;,
However i see the other pikey plugins make a hook to some functions of sceVshBridge i can't find any info on since they're never directly called in homebrew development... are they VSH equivalent of "standard" functions?
Can someone tell me if i'm hooking the wrong functions, and in case what functions/nids should i replace to make my code act as if it was
the OSK??[/color]
Fanjita
Posts: 217
Joined: Wed Sep 28, 2005 9:31 am

Post by Fanjita »

J.F. wrote:Yes, but compare that to the ir main loop - it doesn't even bother trying to translate the serial from whatever into pikey format. It's clearly just a debugging tool, or perhaps just a skeleton that was never fleshed out since there was never a need for it. You either need to redo the SIO input module completely, or remove it and rely on pspirkeyb.

As to the structure of pikey - you'd have to ask fanjita about that. :) The limit of my work on pikey is updating pspirkeyb and adding some messages to certain states.
FWIW, the intention of the SIO input module was to allow input from serial keyboards too. It so happens that I never managed to get hold of a serial keyboard - so it's currently set up to respond to a vt100 terminal connected from the PC. The vt100 mapping layer should be simple to move out of the way if you wanted to map from some other protocol - and if you're just sending mostly ASCII text, then IIRC vt100 is more or less transparent in that case.
Got a v2.0-v2.80 firmware PSP? Download the eLoader here to run homebrew on it!
The PSP Homebrew Database needs you!
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

Fanjita wrote:
J.F. wrote:Yes, but compare that to the ir main loop - it doesn't even bother trying to translate the serial from whatever into pikey format. It's clearly just a debugging tool, or perhaps just a skeleton that was never fleshed out since there was never a need for it. You either need to redo the SIO input module completely, or remove it and rely on pspirkeyb.

As to the structure of pikey - you'd have to ask fanjita about that. :) The limit of my work on pikey is updating pspirkeyb and adding some messages to certain states.
FWIW, the intention of the SIO input module was to allow input from serial keyboards too. It so happens that I never managed to get hold of a serial keyboard - so it's currently set up to respond to a vt100 terminal connected from the PC. The vt100 mapping layer should be simple to move out of the way if you wanted to map from some other protocol - and if you're just sending mostly ASCII text, then IIRC vt100 is more or less transparent in that case.
Good to know. Thanks. :)
folklord904
Posts: 12
Joined: Sat Apr 26, 2008 1:50 pm

Post by folklord904 »

just when i think i understand how to get chat pad working on psp there is all this extra stuff to understand. wehh hey jean do u still have to flash chat pad to get it to work like this?
Art
Posts: 642
Joined: Wed Nov 09, 2005 8:01 am

Post by Art »

Probably should have posted in your chatpad hardware thread,
but how is the hardware looking?
I remember you were going to use CD jewel case material to finish it off,
or does that wait until you are truly satisfied with the pic program?
If not actually, then potentially.
folklord904
Posts: 12
Joined: Sat Apr 26, 2008 1:50 pm

Post by folklord904 »

mine is a flip screen laptop psp and the keyboard goes where the screen was but i cant really finish till i flash the keyboard and put it in permanantly but im so confused with all ur programing what not idk if its working because i thought it was fully functional in games, xmb and the sony text enty thing. but im going to buy my pic programmer soon and there isnt a pic for wireing and i dont have a "sniffer" to test the input and all that is released is the output from chat pad. so im kinda running in circles here
folklord904
Posts: 12
Joined: Sat Apr 26, 2008 1:50 pm

Post by folklord904 »

J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

That's pretty nifty. :)
User avatar
jean
Posts: 489
Joined: Sat Jan 05, 2008 2:44 am

Post by jean »

WOW...very nice. For what concerns flashing, it's not that difficult. Download all the three packages i posted: the last contains latest firmware to flash into the chatPad, while scattered around the other zips there are instructions, pics and wiring diagrams (i know: i should upgrade this thing and put togheter a guide but i'm always so busy...maybe the next week i'll find some time to do so).
If you read the discussion in "openKeyboard project" you will find links to pic-programmers howtos and some advices.
PS: did you really put togheter that thing without gathering infos on how it works, before????
Post Reply