PSPLINK

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

Moderators: cheriff, TyRaNiD

Post Reply
TyRaNiD
Posts: 907
Joined: Sun Jan 18, 2004 12:23 am

Post by TyRaNiD »

New binary release on ps2dev.org. Mainly fixes added such as fixing the wifi code to support something other than the first configuration (oops) and endian fixed for mac (double oops). Also added a thread monitor so you can get information on the terminal when threads are created, started, exited or deleted.
jockyw2001
Posts: 339
Joined: Thu Sep 29, 2005 4:19 pm

Post by jockyw2001 »

Thanks for this even better version TyRaNiD.
I hope kernel module debugging support will be in the next version?
User avatar
Shazz
Posts: 244
Joined: Tue Aug 31, 2004 11:42 pm
Location: Somewhere over the rainbow
Contact:

Post by Shazz »

Ep Tyranid,

I add to modify a few stuff to get the gost drivers compiling on Mac OSX (PowerPC) :

Code: Select all

#include <netdb.h>
#define SOL_TCP getprotobyname&#40;"TCP"&#41;->p_proto /* SOL_TCP and SOL_IP undefined */
To get PCTERM compiling I had to add <string.h> and remove the references to

Code: Select all

	//rl_bind_key_in_map&#40;META&#40;'r'&#41;, cli_reset, emacs_standard_keymap&#41;;
	//rl_bind_key_in_map&#40;META&#40;'s'&#41;, cli_step, emacs_standard_keymap&#41;;
	//rl_bind_key_in_map&#40;META&#40;'k'&#41;, cli_skip, emacs_standard_keymap&#41;;
but currently when psplink 0.9g is running in USB shell+host mode I've got :

Code: Select all

d80-170-38-246&#58;~/Documents/PSP/pspsvn/psp/psplink/usbhostfs_pc shazz$ sudo ./usbhostfs_pc /usr/local/pspdev/psp/sdk/samples/gu/sprite/
USBHostFS &#40;c&#41; TyRaNiD 2k6
Connected to device
Read cancelled &#40;remote disconnected&#41;
Connected to device
Read cancelled &#40;remote disconnected&#41;
...
- TiTAN Art Division -
http://www.titandemo.org
moonlight
Posts: 567
Joined: Wed Oct 26, 2005 7:46 pm

Post by moonlight »

A little "bug" in the documentation.

Name thstun
Synonym mn
Arguments uid|@name
Description Stops then unloads a module in one operation.


It should be modstun, not thstun
User avatar
Drakonite
Site Admin
Posts: 990
Joined: Sat Jan 17, 2004 1:30 am
Contact:

Post by Drakonite »

In response to the problems with usb "read cancelled (remote disconnected)", I've been trying to set things up and was having the same problems.

I haven't done enough checking to be sure, but it appears it involves either some changes or bugfixes in libusb.

Updating to at least v0.1.11 of libusb seems to fix the problem.

I've noticed a couple people mention gentoo (and I too use gentoo sadly). The version of libusb currently marked as stable for x86 is 0.1.10a, so you'll have to use the ~x86 branch.


Tyr: I know it's not as heroic as writing a driver, but telling people to update libusb seems a lot easier no? ;)
Shoot Pixels Not People!
Makeshift Development
danzel
Posts: 182
Joined: Fri Nov 04, 2005 11:03 pm

Post by danzel »

Finally found the time to try it, and YEAH THAT MAKES IT GO :D :D :D
libusb 0.1.11 makes it all good :))))

Thanks all. Awesome program!
urchin
Posts: 121
Joined: Thu Jun 02, 2005 5:41 pm

Post by urchin »

I tried usbhostfs_pc on OS X 10.4 and I was getting the same "disconnected" results as Shazz.

I've tried .12, .11 and .10 versions of libusb, but with no luck. Setting USB_TIMEOUT to 10000 stopped the "disconnected" message, but as soon I telnet and send a command, I get the following:
USBHostFS (c) TyRaNiD 2k6
Connected to device
Accepting shell connection from 127.0.0.1
Read cancelled (remote disconnected)
Connected to device
Bus error
Any ideas?
urchin
Posts: 121
Joined: Thu Jun 02, 2005 5:41 pm

Post by urchin »

The only bit of progress I can manage is to launch PSPLINK after starting usbhost_pc and telnetting. I get the "host0:/>" prompt displayed in telnet, but then I get the same bus error as mentioned above after submitting the first command.
TyRaNiD
Posts: 907
Joined: Sun Jan 18, 2004 12:23 am

Post by TyRaNiD »

Hmm is there any chance of getting OSX to core dump ? I am obviously doing a misaligned read somewhere (and without a mac and osx to try it on it is kind of difficult to fix). If you can core dump or run it under gdb then tell me where it crashes and ill see if I can work out what I am doing wrong.
urchin
Posts: 121
Joined: Thu Jun 02, 2005 5:41 pm

Post by urchin »

I've not managed to make it core dump yet - I can't try until later today. In the meantime, does the CrashReporter log provide you the necessary info? (This is using 0.1.12 of libusb btw, I can build it with previous versions if that helps)

Code: Select all

Exception&#58;  EXC_BAD_ACCESS &#40;0x0001&#41;
Codes&#58;      KERN_PROTECTION_FAILURE &#40;0x0002&#41; at 0x00000010

Thread 0&#58;
0   libSystem.B.dylib         	0x9000b208 mach_msg_trap + 8
1   libSystem.B.dylib         	0x9000b15c mach_msg + 60
2   com.apple.framework.IOKit 	0x90a6e85c io_service_close + 88
3   com.apple.framework.IOKit 	0x90a6cb44 IOServiceClose + 24
4   com.apple.iokit.IOUSBLib  	0x000bbba4 IOUSBDeviceClass&#58;&#58;~IOUSBDeviceClass &#91;unified&#93;&#40;&#41; + 148
5   com.apple.iokit.IOUSBLib  	0x000bb58c IOUSBIUnknown&#58;&#58;release&#40;&#41; + 64
6   libusb-0.1.4.dylib        	0x0166ad60 usb_os_find_devices + 524 &#40;darwin.c&#58;1061&#41;
7   libusb-0.1.4.dylib        	0x01666f84 usb_find_devices + 56 &#40;usb.c&#58;99&#41;
8   usbhostfs_pc              	0x00007994 wait_for_device + 48 &#40;main.c&#58;1822&#41;
9   usbhostfs_pc              	0x00008478 start_hostfs + 36 &#40;main.c&#58;2023&#41;
10  usbhostfs_pc              	0x0000a914 main + 312 &#40;main.c&#58;2844&#41;
11  usbhostfs_pc              	0x00001f24 _start + 348 &#40;crt.c&#58;272&#41;
12  usbhostfs_pc              	0x00001dc4 start + 60

Thread 1 Crashed&#58;
0   <<00000000>> 	0xffff8260 __spin_lock + 0 &#40;cpu_capabilities.h&#58;178&#41;
1   com.apple.CoreFoundation  	0x9078df6c CFRunLoopStop + 32
2   com.apple.framework.IOKit 	0x90a6c830 IODispatchCalloutFromCFMessage + 576
3   com.apple.CoreFoundation  	0x9076adb0 __CFMachPortPerform + 176
4   com.apple.CoreFoundation  	0x9076acc4 __CFRunLoopDoSource1 + 152
5   com.apple.CoreFoundation  	0x9075d3dc __CFRunLoopRun + 1556
6   com.apple.CoreFoundation  	0x9075ca0c CFRunLoopRunSpecific + 268
7   libusb-0.1.4.dylib        	0x0166a524 usb_bulk_transfer + 984 &#40;darwin.c&#58;841&#41;
8   libusb-0.1.4.dylib        	0x0166a70c usb_bulk_write + 72 &#40;darwin.c&#58;889&#41;
9   usbhostfs_pc              	0x00002ac8 euid_usb_bulk_write + 80 &#40;main.c&#58;183&#41;
10  usbhostfs_pc              	0x0000a5b8 async_thread + 1924 &#40;main.c&#58;2769&#41;
11  libSystem.B.dylib         	0x9002b200 _pthread_body + 96

Thread 1 crashed with PPC Thread State 64&#58;
  srr0&#58; 0x00000000ffff8260 srr1&#58; 0x000000000000d030                        vrsave&#58; 0x0000000000000000
    cr&#58; 0x44028288          xer&#58; 0x0000000000000004   lr&#58; 0x000000009078df6c  ctr&#58; 0x0000000090126670
    r0&#58; 0x000000009078df6c   r1&#58; 0x00000000f007f070   r2&#58; 0x000000000166d008   r3&#58; 0x0000000000000010
    r4&#58; 0x0000000000000000   r5&#58; 0x0000000000000012   r6&#58; 0x0000000000000001   r7&#58; 0x0000000000000048
    r8&#58; 0x00000000f007f6bc   r9&#58; 0x0000000000000018  r10&#58; 0x0000000000000069  r11&#58; 0x00000000a073b2d8
   r12&#58; 0x0000000090126670  r13&#58; 0x0000000000000000  r14&#58; 0x0000000000000001  r15&#58; 0x0000000000000001
   r16&#58; 0x0000000000000000  r17&#58; 0x0000000000000000  r18&#58; 0x0000000000001f03  r19&#58; 0x0000000000000000
   r20&#58; 0x0000000000000069  r21&#58; 0x0000000090957de2  r22&#58; 0x0000000000502b78  r23&#58; 0x0000000000000000
   r24&#58; 0x0000000000000000  r25&#58; 0x0000000000000008  r26&#58; 0x00000000f007f260  r27&#58; 0x00000000005024c0
   r28&#58; 0x0000000000502450  r29&#58; 0x0000000000000010  r30&#58; 0x0000000000000008  r31&#58; 0x0000000090a6c5fc
urchin
Posts: 121
Joined: Thu Jun 02, 2005 5:41 pm

Post by urchin »

This might be helpful too - I set the "usb_debug" var to a higher value:

Code: Select all

USBHostFS &#40;c&#41; TyRaNiD 2k6
usb_os_find_busses&#58; Found 001
usb_os_find_busses&#58; Found 002
usb_os_find_devices&#58; Found USB device at location 0x18000000
usb_os_find_devices&#58; Found 001-05ac-8005-09-00 on 001 at location 0x18000000
usb_os_find_devices&#58; Found USB device at location 0x19000000
usb_os_find_devices&#58; Found USB device at location 0x19100000
usb_os_open&#58; 05ac&#58;8005
usb_os_open&#40;USBDeviceOpenSeize&#41;&#58; another process has device opened for exclusive access
usb_control_msg&#58; 128 6 512 0 0xbffff478 8 1000
usb_control_msg&#58; 128 6 512 0 0x501510 27 1000
usb_os_close&#58; 05ac&#58;8005
usb_os_find_devices&#58; Found USB device at location 0x18000000
usb_os_find_devices&#58; Found USB device at location 0x19000000
usb_os_find_devices&#58; Found 001-05ac-8005-09-00 on 002 at location 0x19000000
usb_os_find_devices&#58; Found USB device at location 0x19100000
usb_os_find_devices&#58; Found 003-054c-01c9-00-00 on 002 at location 0x19100000
usb_os_open&#58; 054c&#58;01c9
usb_control_msg&#58; 128 6 512 0 0xbffff478 8 1000
usb_control_msg&#58; 128 6 512 0 0x502320 39 1000
usb_os_close&#58; 054c&#58;01c9
usb_os_open&#58; 05ac&#58;8005
usb_os_open&#40;USBDeviceOpenSeize&#41;&#58; another process has device opened for exclusive access
usb_control_msg&#58; 128 6 512 0 0xbffff478 8 1000
usb_control_msg&#58; 128 6 512 0 0x5023e0 27 1000
usb_os_close&#58; 05ac&#58;8005
usb_os_open&#58; 054c&#58;01c9
usb_set_configuration&#58; called for config 1
usb_claim_interface&#58; called for interface 0
Interface 0 of device is 0x00001137
claim_interface&#58; Interface 0 of device from QueryInterface is 0x502500
libusb/darwin.c get_endpoints&#58; building table of endpoints.
get_endpoints&#58; Pipe 1&#58; DIR&#58; 1 number&#58; 1
get_endpoints&#58; Pipe 2&#58; DIR&#58; 0 number&#58; 2
get_endpoints&#58; Pipe 3&#58; DIR&#58; 0 number&#58; 3
libusb/darwin.c get_endpoints&#58; complete.
Connected to device
libusb/darwin.c ep_to_pipeRef&#58; Converting ep address to pipeRef.
libusb/darwin.c usb_bulk_transfer&#58; Transfering 4 bytes of data on endpoint 0x02
io async operation completed&#58; no error, size=4, result=0x00000000
libusb/darwin.c ep_to_pipeRef&#58; Converting ep address to pipeRef.
libusb/darwin.c usb_bulk_transfer&#58; Transfering 512 bytes of data on endpoint 0x81
io async operation completed&#58; no error, size=12, result=0x00000000
usb_bulk_read&#58; input timed out
libusb/darwin.c ep_to_pipeRef&#58; Converting ep address to pipeRef.
libusb/darwin.c usb_bulk_transfer&#58; Transfering 12 bytes of data on endpoint 0x02
io async operation completed&#58; no error, size=12, result=0x00000000
libusb/darwin.c ep_to_pipeRef&#58; Converting ep address to pipeRef.
libusb/darwin.c usb_bulk_transfer&#58; Transfering 512 bytes of data on endpoint 0x81
io async operation completed&#58; transaction aborted, size=0, result=0xe00002eb
usb_bulk_read&#58; input timed out
Read cancelled &#40;remote disconnected&#41;
usb_os_close&#58; 054c&#58;01c9
The last 512 byte transfer times out after USB_TIMEOUT and the whole cycle repeats until a command is entered, causing the bus error.
User avatar
Shazz
Posts: 244
Joined: Tue Aug 31, 2004 11:42 pm
Location: Somewhere over the rainbow
Contact:

Post by Shazz »

If I can provide any help in testing something on the mac, Tyranid, just ask.... (debug version of usbhostfs_pc...)
- TiTAN Art Division -
http://www.titandemo.org
urchin
Posts: 121
Joined: Thu Jun 02, 2005 5:41 pm

Post by urchin »

OK, it appears that the problem is with libusb and not PSPLINK. I tried libusb versions .12 -> .8 and the included tests don't even work!

On the bright side, YAY!

I downloaded a pre-built libusb from here, http://www.ellert.se/twain-sane/, and it works! I'm not sure what the problem is, but it works with this version.

Nice app TyRaNiD! :)
TyRaNiD
Posts: 907
Joined: Sun Jan 18, 2004 12:23 am

Post by TyRaNiD »

That is good, all I can say is "bloody libusb"!!! ;)
urchin
Posts: 121
Joined: Thu Jun 02, 2005 5:41 pm

Post by urchin »

I'm having more problems :( and I can't be sure libusb is the cause.

My test program reads in a text file a character at a time using fread, which is then printed to the screen. After what appears to be 1024 characters, the beginning of the file starts to be printed again.

The problem first appeared when reading the file over usbhostfs. I then copied the file to the memory stick and changed the program to read from there. Starting the program from PSPLINK produced the same corrupt results.

If I run the program without using PSPLINK it works as it should. I'm assuming PSPLINK patches the IO functions somehow, but I can't work out where to test further.
User avatar
Shazz
Posts: 244
Joined: Tue Aug 31, 2004 11:42 pm
Location: Somewhere over the rainbow
Contact:

Post by Shazz »

So based on great urchin's discoveries and libusb distrib, I played with psplink/usbhost for a few hours...
Basically it works perfectly with some limitations :

- fread freezes after some calls, use sceIoRead instead
- impossible to load a PNG from host:

Code: Select all

if &#40; setjmp&#40; pPngStruct->jmpbuf &#41; != 0 &#41;
fails.... (not if the png is on ms0) (maybe it uses fread ?)
- host:/ file reading is very slow

=> so I keep my data files on ms0 and all is ok :D
- TiTAN Art Division -
http://www.titandemo.org
urchin
Posts: 121
Joined: Thu Jun 02, 2005 5:41 pm

Post by urchin »

If your files are on ms0:, the usbhost driver is not used (psp will go directly to ms0:) so you won't get any problems.

I now seem to be having problems with fwrite.
urchin
Posts: 121
Joined: Thu Jun 02, 2005 5:41 pm

Post by urchin »

Ach, my bad - I was accidentally linking against psplibc. Things are going better now.

I'm also seeing weirdness with libpng though. It's not failing, but all debug messages are truncated after loading an image. I'll dig into it when I get chance.
User avatar
Shazz
Posts: 244
Joined: Tue Aug 31, 2004 11:42 pm
Location: Somewhere over the rainbow
Contact:

Post by Shazz »

a friend told me he has the same issue with the Windows version while loading png. So it is not only mac related it seems.
- TiTAN Art Division -
http://www.titandemo.org
cory1492
Posts: 216
Joined: Fri Dec 10, 2004 1:49 pm

Post by cory1492 »

I'll say it once again.. PSPLink is an awesome piece of work.

One question: is there a way to log the comms in the included term app or should I look at adding some code to do so? (Im thinking session logs with the filename as the date/time and markers for PSP sent and user sent messages)
TyRaNiD
Posts: 907
Joined: Sun Jan 18, 2004 12:23 am

Post by TyRaNiD »

It is something I have considered but never got around to doing it. If of course you feel like writing something to do it then I dont mind integrating it into the repository :)

Oh and shazz any chance you can dig up a simple example of the png loading failing so I can look at it, unfortunately pretty much everything people have said which fails in psplink I have been unable to replicate. Having some clear examples of broken code might aid me in tracking down problems.
User avatar
Shazz
Posts: 244
Joined: Tue Aug 31, 2004 11:42 pm
Location: Somewhere over the rainbow
Contact:

Post by Shazz »

I'll do that asap (but basically I use the

Code: Select all

void showImage&#40;const char* filename&#41;
from svn->libpng/screenshot/main.c
- TiTAN Art Division -
http://www.titandemo.org
urchin
Posts: 121
Joined: Thu Jun 02, 2005 5:41 pm

Post by urchin »

For loading PNGs I use code I yanked from elsewhere. I'll have a look tonight to compare the differences.

> I've PMed Shazz the code I use
Last edited by urchin on Thu May 11, 2006 5:29 pm, edited 1 time in total.
cory1492
Posts: 216
Joined: Fri Dec 10, 2004 1:49 pm

Post by cory1492 »

TyRaNiD: that and tab completion are what I miss, Ill have a look but I cant promise alot (ie: you will probably have to be the code cleaner-upper if you really want me to add this stuff - but I'd be more than happy to do a lions share of the typing and trial/error if you dont feel like it)

The other day I decided I wanted to go with the SIO, I had been having some problems with the USB shell crashing and I had hoped SIO would solve my issues. Unfortunately, I got a whole new set of issues (and yeah, I tried wifi but it was a crashwhore too with my pci card in AP mode).

Working with the sparkfun adapter (from here) I am able to receive from the PSP at any baud, but I cant send if I set the term/psplink at anything higher than 9600bps. Its odd because I am able to bridge the rx/tx at the psp voltage and have the PC talk to itself fine, but any time I try and send to the psp from the PC both Rx and Tx light up but nothing happens (the psp does not seem to be getting the sends at all). Is anyone else seeing this type of behavior in SIO shell or has everyone moved on to USB and wifi shell?
(riden pointed me at this thread - is this still an issue with serial comms?)
TyRaNiD
Posts: 907
Joined: Sun Jan 18, 2004 12:23 am

Post by TyRaNiD »

Tab completion is something on the list somewhere but really I am not sure how best to implement it in the current implementation. For host stuff I could probably query the usbhostfs_pc stuff through pcterm and do it on the client and I could replicate the command list inside pcterm but that seems ugly. Ill try and add logging sometime soon :)

As for SIO stuff well using pcterm with SIO seems to be potentially unreliable due in part to the lack of flow control as pcterm fires off the entire the command in one go. Also it seems to not like being used with other shells enabled. The best mode for sioshell is to only set sioshell and set pcterm in the ini to 0. That way characters are sent as soon as they are read to the psp eliminating most of the flow control issues. But for that youll want to use something like minicom or tutty, pcterm will still operate in a line based mode.
cory1492
Posts: 216
Joined: Fri Dec 10, 2004 1:49 pm

Post by cory1492 »

even just tab completion for the command list (instead of using help/pdf every time one wants to find a command) and basic/common paths would probably be enough for most everyone.

SIO: I considered that pcterm could be the problem, its why I have been doing all my testing on this with Tera Term. I disabled everything except SIO shell (annoying that I have to hold the power button and reboot every time since it wont accept any commands over the serial) - but basically I'm down to two things and trying to figure out which is the culprit: hardware or software. So far it is a mixed bag, as I have no real answer and it could go either way. I have a Max3232 on its way, so maybe that will help me sort it in the end.
TyRaNiD
Posts: 907
Joined: Sun Jan 18, 2004 12:23 am

Post by TyRaNiD »

I've added basic logging to pcterm by the way, you have to log an entire session (and only output is logged) by specifying it on the command line with the -l option. Best you are going to get atm :P

Have you tried the SIO example in pspsdk with your serial cable ? Youll need to make a call to set the baud rate differently, but at least it would indicate whether it was a hardware or software problem. I guess it could be something weird like an dodgy connection on the PSPs RX pin which just about works at low baud but completly dies at higher speeds, though that seems unlikely.
AnonymousTipster
Posts: 197
Joined: Fri Jul 01, 2005 2:50 am

Post by AnonymousTipster »

I've been using PSPLink (0.9f) for a while now, and it's a really great tool.

So i've been working on something in the PSPLink environment, and everything's working great, however if I run the same eboot in the XMB, I start getting problems. Some of my integers seem to gain random (usually high) values, which makes the app. unstable. I don't know that much about memory allocation, but it sounds like I've got something leaking into those integers and corrupting them. If I define them as static, then they act as normal, but this isn't the best solution, and I'd like to know how I can debug this problem or simulate what PSPLink does to fix this problem.

Thanks.

EDIT: I think I may have found the leak, after adding code to dRead as suggested in the related thread, it seems to have stopped the random values. I have a bad feeling that the compiler is just re-organising the RAM addresses though...
Last edited by AnonymousTipster on Mon May 15, 2006 6:13 am, edited 1 time in total.
optixx00
Posts: 11
Joined: Mon Jul 18, 2005 1:40 am

GDB Problem

Post by optixx00 »

Hi,

i try to use gdb. Any ideas what's going wrong there ?

Usbshell:

Code: Select all

ms0&#58;/apps/>  debug g.elf
ms0&#58;/apps/>  PSPLink GDBServer &#40;c&#41; 2k6 TyRaNiD/Lovely2
GDBServer&#58; Loaded ms0&#58;/apps/g.elf - UID 0x044B185F
gdb g.elf

Code: Select all

GNU gdb 6.4.0.20051202-cvs
&#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
usbhostfs_pc:

Code: Select all

Accepting gdb connection from 127.0.0.1
HOST->GDB &#40;+$Hc-1#09&#41;
HOST->GDB &#40;$Hc-1#09&#41;
HOST->GDB &#40;$Hc-1#09&#41;
HOST->GDB &#40;$Hc-1#09&#41;
HOST->GDB &#40;-&#41;
HOST->GDB &#40;-&#41;
HOST->GDB &#40;-+$qC#b4&#41;
HOST->GDB &#40;$qC#b4&#41;
HOST->GDB &#40;$qC#b4&#41;
HOST->GDB &#40;$qC#b4&#41;
HOST->GDB &#40;-&#41;
HOST->GDB &#40;-&#41;
HOST->GDB &#40;-+$qOffsets#4b&#41;
HOST->GDB &#40;$qOffsets#4b&#41;
HOST->GDB &#40;$qOffsets#4b&#41;
HOST->GDB &#40;$qOffsets#4b&#41;
HOST->GDB &#40;-&#41;
Read cancelled &#40;remote disconnected&#41;
Connected to device
TyRaNiD
Posts: 907
Joined: Sun Jan 18, 2004 12:23 am

Post by TyRaNiD »

optixx00, strange that you are not getting any results from the PSP side of GDB, stupid question but did you enable usbgdb in the configuration file ? Although it really shouldn't matter, if you had enabled wifi it probably would fail before it got anywhere, or at the very least have printed a different IP address (maybe).
Post Reply