PSPLINK

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

Moderators: cheriff, TyRaNiD

Post Reply
Kojima
Posts: 275
Joined: Mon Jun 26, 2006 3:49 am

Post by Kojima »

ok thanks. i just built usbhostfs and it appears to work.

One thing I'm little confused by, reading the manual, is that it loads prfx and some other format i've never heard of (Bear in mind this is only my second day of psp dev), can they be made from elfs/pbps or do I have to figure out how to write a makefile to build them specifically?
Kojima
Posts: 275
Joined: Mon Jun 26, 2006 3:49 am

Post by Kojima »

Hmm, well I've set it all up according to the manual but it doesn't work.

Steps I took,

1) Install psplink on psp, set up ini file to use usb etc.

2) Run psplink on psp, am greeted with shell "host0\" etc so that appears to be fine.

3)On running windows made the 'device connected sound' and asked me for the drivers. I pointed it to the windows/driver folder and it installed PSP type B perfectly.

4) Then, following the manual I run usbhostfs_pc with an argument of the dir my elf is in.

This is where things start going wrong. There is no "Device connected" line as specified by the user manual.

But I try the next step anyway, in case usbhost has been updated.

6) Run pc term with no arguments.

This does nothing. no host0:\ line,. just a single line saying 'trying to connect to port 10000'
Shouldn't it be connecting via usb? or does the usb driver emulate ports etc?

And at this point there's nothing left to try.

Any help would be appreciated, I'm looking forward to quick dev times tools like psplink bring.

Here's my psplink ini file if it helps track down the problem.

Code: Select all

# Example psplink configuration file.

# usbmass=[0 1] Enable USB mass storage. Set to 1 to enable automatically
usbmass=0

# usbhost=[0 1] Enable USB host file system. Set to 1 to enable automatically
usbhost=1

# pluser=[0 1] Enable the PSPLink user module
pluser=1

# resetonexit=[0 1] Specify wheher to reset psplink when sceKernelExitGame
# is called
resetonexit=1

# sioshell=[0 1] Specify whether to start up the sio shell
sioshell=0

# kprintf=[0 1] Specify that SIO should be used for kprintf only, setting sioshell
# to 1 overrides this setting.
kprintf=1

# wifi=[0..N] Specify wifi should be enabled, the number is the 
# configuration to use if > 0
wifi=0

# wifishell=[0 1] Specify whether to start up the wifi shell
wifishell=0

# usbshell=[0 1] Specify whether to start up the usb shell
usbshell=1

# usbgdb=[0 1] Specify whether to use USB gdb or wifi gdb
usbgdb=1

# conshell=[0 1] Specify whether to start up the console shell
conshell=1

# consinterfere[0 1] Specifiy whether the consoleshell may interfere with
# programs in execution
consinterfere=0

# the commands that is run when buttons are pressed in the console shell
conscrosscmd=ld ms0:/sprite.elf
conssquarecmd=thlist
constrianglecmd=modlist
conscirclecmd=
consselectcmd=meminfo
consstartcmd=ls
consdowncmd=scrshot ms0:/scshot.bmp
consleftcmd=usbmoff
consrightcmd=usbmon
consupcmd=cop0

# prompt=... Set the psplink shell prompt
# There are some escape characters, mainly %d to print the current dir
prompt="%d> "

# path=... Set the psplink shell path
# Each path is separated by a semi-colon, you can specify up to around 128 characters
# path=ms0:/apps;ms0:/

# pcterm=[0 1] Indicates whether we are using pcterm as a client or normal
# tools
pcterm=0

# baud=[4800..115200] Set the SIO baud rate (should only use as a last resort)
# baud=115200

# modload=path Load a module on start up, repeat as necessary for more modules

# Example: load the modules for networking
# modload=flash0:/kd/ifhandle.prx
# modload=flash0:/kd/pspnet.prx
# modload=flash0:/kd/pspnet_inet.prx
# modload=flash0:/kd/pspnet_apctl.prx
# modload=flash0:/kd/pspnet_resolver.prx



Thanks
-=Diablo=-
Posts: 1
Joined: Thu Jul 13, 2006 6:52 am

Post by -=Diablo=- »

anyone know if a port of this will be made so us xp64 users can use it? or maybe rewritten slightly? i can use a usb driver program to create a 64bit driver and install it

Code: Select all

http://www.thesycon.de/eng/usbio.shtml
but since the pc program itself is coded to use libusb which is 32bit i cant use it
gr8dane
Posts: 16
Joined: Thu Aug 18, 2005 11:10 am

PSPLink Net Modules

Post by gr8dane »

I have used PSP link for some time now and all is great.

I now wanted to convert one of my apps that uses some network code. That code previously ran in kernel mode as it needed to load the appropriate PRX files and patch them.

Now we can only use pure user mode in PSPLink so I added the appropriate modules in the PSPLink INI file.

The modules get loaded fine when PSPLink starts, as verified with the "modlist" command.

My question now is, what do I do now? I can't just call a fuction like "sceNetInit()" as it gives me back an error code of 8002012e.

Any help with using external prx net modules from within PSPLink would be greately appreciated, thanks!
TyRaNiD
Posts: 907
Joined: Sun Jan 18, 2004 12:23 am

Post by TyRaNiD »

Well it should be possible to port it to xp64 there are ports of libusb for x64 but I have never tried it primarily because I rarely enough run windows and I lack a 64bit machine. You are lucky there is a windows version at all. While usbio stuff looks nice it does have the serious issue that it is none free (and I dont mean in the GPL sense), and considering it costs 1750e for a runtime license so you are able to distribute the resulting binaries I think it is slightly out of our price range, you could pay for a dev license though and use it for personal use but for that kind of effort I would just dump windows and install a decent OS ;)

Then there is also the User Mode Driver Framework from Microsoft which is in beta atm and will ship with Vista (maybe) and works on xp sp2. This does something similar, would work on any version of windows and is free but I don't feel like doing anything with it :) This is none withstanding the fact that you could write a proper kernel driver to do it.

Anyway you are on your own, I am not going to fix it anytime soon unless someone donates me a 64bit PC and xp64 ;)

No doubt the warezers will write one eventually but that wont help psplink in any way.
TyRaNiD
Posts: 907
Joined: Sun Jan 18, 2004 12:23 am

Post by TyRaNiD »

gr8dane this is a simple app I knocked up in a few minutes and seems to initalise quite happily under psplink, built as an elf or prx.

Code: Select all

#include <pspkernel.h>
#include <pspsdk.h>
#include <pspnet.h>
#include <stdio.h>

/* Define the module info section */
PSP_MODULE_INFO&#40;"template", 0, 1, 1&#41;;

/* Define the main thread's attribute value &#40;optional&#41; */
PSP_MAIN_THREAD_ATTR&#40;THREAD_ATTR_USER&#41;;

int main&#40;int argc, char *argv&#91;&#93;&#41;
&#123;
    SceUID uid;
    u32 retVal;

    uid = pspSdkLoadStartModule&#40;"flash0&#58;/kd/ifhandle.prx", PSP_MEMORY_PARTITION_KERNEL&#41;;
    if&#40;uid < 0&#41;
    &#123;
        printf&#40;"Couldn't load ifhandle %08X\n", uid&#41;;
        return 0;
    &#125;
    uid = pspSdkLoadStartModule&#40;"flash0&#58;/kd/pspnet.prx", PSP_MEMORY_PARTITION_USER&#41;;
    if&#40;uid < 0&#41;
    &#123;
        printf&#40;"Couldn't load pspnet %08X\n", uid&#41;;
        return 0;
    &#125;
    uid = pspSdkLoadStartModule&#40;"flash0&#58;/kd/pspnet_inet.prx", PSP_MEMORY_PARTITION_USER&#41;;
    if &#40;uid < 0&#41;
    &#123;
        printf&#40;"Couldn't load pspnet_inet %08X\n", uid&#41;;
        return 0;
    &#125;
    uid = pspSdkLoadStartModule&#40;"flash0&#58;/kd/pspnet_apctl.prx", PSP_MEMORY_PARTITION_USER&#41;;
    if &#40;uid < 0&#41;
    &#123;
        printf&#40;"Couldn't load pspnet_apctl %08X\n", uid&#41;;
        return 0;
    &#125;
    uid = pspSdkLoadStartModule&#40;"flash0&#58;/kd/pspnet_resolver.prx", PSP_MEMORY_PARTITION_USER&#41;;
    if &#40;uid < 0&#41;
    &#123;
        printf&#40;"Couldn't load pspnet_resolver %08X\n", uid&#41;;
        return 0;
    &#125;

    retVal = pspSdkInetInit&#40;&#41;;
    if&#40;retVal != 0&#41;
    &#123;
        printf&#40;"Could not initialise network drivers %08X\n", retVal&#41;;
    &#125;

    return 0;
&#125;
AnonymousTipster
Posts: 197
Joined: Fri Jul 01, 2005 2:50 am

Post by AnonymousTipster »

Hi Tyranid,
I was wondering if there was a way with PSPLink to detect where addresses are leaking? E.g, I call array[11] = 0; on an array[10].
Is there a way to do something like this?
Thanks.
TyRaNiD
Posts: 907
Joined: Sun Jan 18, 2004 12:23 am

Post by TyRaNiD »

Nope there isn't anyway psplink can help on that. The best you can get is to use the hardware debugger at the appropriate point to tell you if something writes to the wrong place (assuming you know something is doing it in the first place).
Def Base
Posts: 6
Joined: Mon Jul 17, 2006 9:24 am

Post by Def Base »

Hi. I have almost the same (end result) problem as Kojima.

I've set everything up on my SuSE 10 box, everything being the toolchain, SDK, USBHostFS etc, but I'm still having a problem with PSPLink.

I connect my PSP and load PSPLink successfully. When I run USBHostFS_PC the initial "by Tyranid" prompt comes up, but nothing else. If I then telnet to localhost:10000 I can connect successfully (and the bash showing USBHostFS_PC logs a connection occuring), but I can't do anything else. My commands are echoed back to me but nothing happens. I don't get the connected message the docs indicate I should receive.

Anyone able to help, or to tell me what other information I should provide to make helping possible? Thanks.
Kojima
Posts: 275
Joined: Mon Jun 26, 2006 3:49 am

Post by Kojima »

Endenour I fixed the connection problem by copying usb.h from the svn psplinkv2 folder into the cygwin/usr/include folder and rebuilding usbhostfs_pc
But it still doesn't work for me, it connects then locks up the usb. I'd be interested to know if you have more luck than I've had.
Def Base
Posts: 6
Joined: Mon Jul 17, 2006 9:24 am

Post by Def Base »

Hm, ok, ignore my previous post. My psplink.ini file was corrupted, fixing it solved my problem.
lixx
Posts: 5
Joined: Sat May 06, 2006 11:13 pm

Post by lixx »

Hi!
Would it be possible to compile a version of usbhostfs to run on iPod Linux (http://ipodlinux.org/Main_Page)? It would be nice to share some files on its hdd.

greetings lixx
futaris
Posts: 45
Joined: Wed Dec 28, 2005 7:47 am

Post by futaris »

ipod linux only supports usb slave, not usb host AFAIK. http://ipodlinux.org/USB says it's status isn't working yet. NB, I have got USBHostfs working on my Asus WL-HDD running OpenWRT, though.
jonny
Posts: 351
Joined: Thu Sep 22, 2005 5:46 pm
Contact:

Post by jonny »

@TyRaNiD:
only wanted to say big thanks for psplink (i dunno why i've waited so long before using this beauty)
moonlight
Posts: 567
Joined: Wed Oct 26, 2005 7:46 pm

Post by moonlight »

A small bug in the code.
File psplink/shell.c function static int reset_cmd(int argc, char **argv):

Code: Select all

if&#40;strcmp&#40;argv&#91;0&#93;, "game"&#41; == 0&#41;
&#123;
       g_context.rebootkey = REBOOT_MODE_GAME;
&#125;
else if&#40;strcmp&#40;argv&#91;0&#93;, "vsh"&#41; == 0&#41;
&#123;
       g_context.rebootkey = REBOOT_MODE_VSH;
&#125;
else if&#40;strcmp&#40;argv&#91;0&#93;, "updater"&#41; == 0&#41;
&#123;
       g_context.rebootkey = REBOOT_MODE_VSH;
&#125;
In the "updater" case it should be: g_context.rebootkey = REBOOT_MODE_UPDATER;
jimparis
Posts: 1145
Joined: Fri Jun 10, 2005 4:21 am
Location: Boston

Post by jimparis »

moonlight wrote:n the "updater" case it should be: g_context.rebootkey = REBOOT_MODE_UPDATER;
Fixed in rev 1991
User avatar
Wally
Posts: 663
Joined: Mon Sep 26, 2005 11:25 am

Post by Wally »

Im having a bit of trouble getting pcterm to work in OSX

Everything but it works.

It says
Opening connection to localhost port 10000
Retrying connection
Retrying connection
Retrying connection
Retrying connection
Retrying connection
getsockopt: Connection refused

However i did have to remove

int init_readline(void)
{
rl_bind_key_in_map(META('r'), cli_reset, emacs_standard_keymap);
rl_bind_key_in_map(META('s'), cli_step, emacs_standard_keymap);
rl_bind_key_in_map(META('k'), cli_skip, emacs_standard_keymap);
rl_callback_handler_install("", cli_handler);
g_context.promptwait = 1;

return 1;
}
as mac os x didnt recognise the emacs symbols and doenst have LDconfig either.
DeNitro
Posts: 4
Joined: Fri Sep 16, 2005 5:13 pm

Post by DeNitro »

TyRaNiD, Thank you for creating PSPLINK. It a great development tool and I use it regularly.

I recently got a new PC together and installed Windows XP x64 to give it a try. One of the first things I played with was getting PSPLINK to work with x64. I saw the earlier post about someone asking about it, so I packaged it up so he and others can get it working easily.

http://tiger.towson.edu/~bdelkh1/usbhos ... rs_x64.rar

It includes a copy of usbhostfs_pc and libUSB drivers that work with Windows XP x64. I included pcterm and the cygwin DLL's too just in case.

--DeNitro
rzxiao
Posts: 13
Joined: Sun Feb 05, 2006 7:55 pm

About PSPLink's compile

Post by rzxiao »

Hi, I just checkout the source code of PSPLink from SVN, and have my psptoolchain updated to newest version and try to compile the psplink,a error happened:

netgdb.c:25:25: error: netinet/tcp.h: No such file or directory

I check with my pspdev:
F:\cygwin\usr\local\pspdev\psp\include\netinet\ only a in.h exist,no tcp.h

I failed to install pspdev correctly or anything else?

any tips? Thank you very much.

BTW,I use cygwin in windows xp .
TyRaNiD
Posts: 907
Joined: Sun Jan 18, 2004 12:23 am

Post by TyRaNiD »

DeNitro, nice one, been waiting for someone to actually get the finger out and sort out x64 xp :) I might put the drivers into svn at some point.

rzxiao, well you obviously have a toolchain problem what ever, the toolchain comes with the required files, perhaps you only thought it updated correctly or something I dont know.
zoret
Posts: 22
Joined: Sun Mar 19, 2006 7:57 pm

PSPLINK ! please help me ! ;)

Post by zoret »

hi

i've have to use the psplink in order to debug my elf
i've exactly followed this guide

http://forums.qj.net/f-psp-development- ... 49335.html

i've compiled and copied the psplink files on the psp/game ms directory
i've compiled the usbhostfs_pc.exe tool

everything seems to be ok

when i launch usbhostfs_pc.exe , i've the following message "found 4 busses"
when i launch pcterm this message appears "Accepting async connection (0) from 127.0.0.1"
and when i launch psplink from the psp osd this final message appears : "Connected to device"

and the psp displays "PSPLINK user module v2.0 Final"

and after that ?

in the tutorial they explain how to list files from the memory stick using theses commands:
"cd ms0:/psp/game
ls"
but this doesn't work for me :
"cd ms0:/psp/game
chdir: No such file or directory"

when i tape pwd it seems i'm in the cygwin home directory

any ideas ???

what is the next steps to debug my elf ?
first if i could have a tty output it will be great !

thanks in advance for any help !



i have to add than theses messages "found 4 busses" "Accepting async connection (0) from 127.0.0.1" "Connected to device" appear in the usbhostfs_pc.exe window


for this message "Accepting..." in fact i don't launch pcterm but telnet localhost 10000

this is the psplink ini file i'm using:

# Example psplink configuration file.

# usbmass=[0 1] Enable USB mass storage. Set to 1 to enable automatically
usbmass=1

# usbhost=[0 1] Enable USB host file system. Set to 1 to enable automatically
usbhost=1

# pluser=[0 1] Enable the PSPLink user module
pluser=1

# resetonexit=[0 1] Specify wheher to reset psplink when sceKernelExitGame
# is called
resetonexit=1

# sioshell=[0 1] Specify whether to start up the sio shell
sioshell=0

# kprintf=[0 1] Specify that SIO should be used for kprintf only, setting sioshell
# to 1 overrides this setting.
kprintf=1

# wifi=[0..N] Specify wifi should be enabled, the number is the
# configuration to use if > 0
wifi=0

# wifishell=[0 1] Specify whether to start up the wifi shell
wifishell=0

# usbshell=[0 1] Specify whether to start up the usb shell
usbshell=1

# usbgdb=[0 1] Specify whether to use USB gdb or wifi gdb
usbgdb=1

# conshell=[0 1] Specify whether to start up the console shell
conshell=0

# consinterfere[0 1] Specifiy whether the consoleshell may interfere with
# programs in execution
consinterfere=0

# the commands that is run when buttons are pressed in the console shell
conscrosscmd=ld ms0:/sprite.elf
conssquarecmd=thlist
constrianglecmd=modlist
conscirclecmd=
consselectcmd=meminfo
consstartcmd=ls
consdowncmd=scrshot ms0:/scshot.bmp
consleftcmd=usbmoff
consrightcmd=usbmon
consupcmd=cop0

# prompt=... Set the psplink shell prompt
# There are some escape characters, mainly %d to print the current dir
prompt="%d> "

# path=... Set the psplink shell path
# Each path is separated by a semi-colon, you can specify up to around 128 characters
# path=ms0:/apps;ms0:/

# pcterm=[0 1] Indicates whether we are using pcterm as a client or normal
# tools
pcterm=0

# baud=[4800..115200] Set the SIO baud rate (should only use as a last resort)
# baud=115200

# modload=path Load a module on start up, repeat as necessary for more modules

# Example: load the modules for networking
# modload=flash0:/kd/ifhandle.prx
# modload=flash0:/kd/pspnet.prx
# modload=flash0:/kd/pspnet_inet.prx
# modload=flash0:/kd/pspnet_apctl.prx
# modload=flash0:/kd/pspnet_resolver.prx
Paou
Posts: 5
Joined: Sun May 07, 2006 6:57 pm

Post by Paou »

FYI

The 6.4 version of insight fails to compile under cygwin.

Found a fix here:
http://sources.redhat.com/ml/insight/20 ... 00021.html

after applying the changes (i.e. adding __attribute__ ((used)) on the relevant symbols.. ) all is good.


I also have a problem running GDB:

I can get to the point where GDB is stopped on _start, but after typing c to continue, the psp stays on the PSPLINK screen and the term containing GDB hangs till I sever the USB connection :(

This happens even if I don't set a breakpoint or anything.

Simmilar things happen with insight, but I have no idea if my connection settings are correct, have tried Remote/TCP with both no host set and "localhost" with port 10001. Clicking connect to target hangs insight, and nothing much else happens. (As you prob guessed from the port num I'm using USB)

Any clues?

Will try wifi access next and report how I get on
Paou
Posts: 5
Joined: Sun May 07, 2006 6:57 pm

Post by Paou »

Hi again,

OK, everything is working now. It turned out that my evening of re-compiling the toolchain and sdk resulted in a copy of gcc that built bad elfs. I downloaded a "windows auto installer pre built wizard wonder" for the toolchain (as I couldn't be arsed to wait for the script to run again), and now have a working compiler, along with a working copy of gdb AND insight.

Nice.
gab23
Posts: 1
Joined: Mon Oct 16, 2006 7:51 am

Post by gab23 »

o am staying in singapore can anyone sell me Interfacing with the PSP Remote port
goebish
Posts: 29
Joined: Sat Oct 14, 2006 11:59 pm

Post by goebish »

Hi, everything works fine except psp-dbg:

Code: Select all

&#40;gdb&#41; target remote &#58;10001
Remote debugging using &#58;10001
Ignoring packet error, continuing...
Ignoring packet error, continuing...
Ignoring packet error, continuing...
Malformed response to offset query, timeout
I searched this thread for some help but I can't solve my problem.

- I compiled the toolchain, pspsdk, psplink (2.0 final), usbhostfs_pc and psp-gdb from the latest svn.
- I can launch .elf files from the usb shell
- I compiled the sprite sample with the -g flag
- I can run "debug ./sprite.elf" from the shell, but I've no output about it in usbhostfs_pc even with -d and -v arguments:

Code: Select all

host0&#58;/>  debug ./sprite.elf
host0&#58;/>  PSPLink GDBServer &#40;c&#41; 2k6 TyRaNiD/Lovely2
GDBServer&#58; Loaded host0&#58;/sprite.elf - UID 0x017D791F
- usbhost & usbgdb are enable in psplink.ini

I use linux (debian current stable), maybe I miss something about the driver (.inf) needed in windows for usbhost. Do I need something similar under linux ? (I already have libusb-0.1-4 installed)

Thank for your help :)
CrazyT
Posts: 18
Joined: Sat Dec 23, 2006 6:47 pm

Post by CrazyT »

Is it possible to debug the whole Firmware with PSPLINK?
I mean ... can you send PSPLINK into background and test the firmware for some exceptions(to find possible locations for exploits for example :-), or to find locations to modify the fw)?
goebish
Posts: 29
Joined: Sat Oct 14, 2006 11:59 pm

Post by goebish »

My issue with psplink isn't resolved since october (tryed many times)
Any idea anyone ?
TyRaNiD
Posts: 907
Joined: Sun Jan 18, 2004 12:23 am

Post by TyRaNiD »

goebish, sorry I am not sure what causes that issue, it seems that people find that it works or it doesn't not that that really helps you :( I can only guess check and double check the setup you have, ensure you dont have a firewall running etc.

CrazyT, it can be used to debug the kernel to a certain extent but it cannot run in interrupt disabled areas etc so some things it cannot catch or dump the exception of. So basically YMMV.
goebish
Posts: 29
Joined: Sat Oct 14, 2006 11:59 pm

Post by goebish »

Thank you for your answer TyRaNiD. I'll try on more computers, using linux and windows.
cdevine
Posts: 6
Joined: Sat Dec 30, 2006 1:54 am

Post by cdevine »

TyRaNiD wrote:CrazyT, it can be used to debug the kernel to a certain extent but it cannot run in interrupt disabled areas etc so some things it cannot catch or dump the exception of. So basically YMMV.
Hi TyRaNiD,

I've been trying to make a PRX module to catch exceptions generated from the shell:

Code: Select all

        if &#40;&#40;pad.Buttons & &#40;PSP_CTRL_HOME|PSP_CTRL_LTRIGGER|PSP_CTRL_RTRIGGER&#41;&#41;
                        == &#40;PSP_CTRL_HOME|PSP_CTRL_LTRIGGER|PSP_CTRL_RTRIGGER&#41;&#41;
        &#123;
            pspDebugInstallKprintfHandler&#40;NULL&#41;;
            pspDebugInstallErrorHandler&#40;MyExceptionHandler&#41;;
&#125;
It doesn't appear to work though. I've verified that the above code is executed, but when the exception occurs (in this case the TIFF exploit) the PRX doesn't catch it and the VSH freezes.

It is that sceKernelRegisterDefaultExceptionHandler is only local to the current running thread? In that case, do you know if there is another solution to setup a global exception handler?

Thanks,

Christophe
Post Reply