Page 1 of 1

ps2ip_init hangs?

Posted: Sat Jul 10, 2004 9:31 am
by 606u
With a few words: I check whether ELF has been executed from a MC, CD or via PS2LINK (I saw it from ps2menu.c) and in any case, but PS2LINK, I load ps2ip.irx & ps2smap.irx along with some others (once again I saw it from ps2menu.c - using SifExecModuleBuffer).

However, in the following code fragment

Code: Select all

int
serve (void)
{
  const int port = 23;

  printf ("calling ps2ip_init...\n");
  if &#40;ps2ip_init &#40;&#41; < 0&#41;
    &#123;
      printf &#40;"ps2ip_init failed.\n"&#41;;
      return &#40;-1&#41;;
    &#125;
  else
    printf &#40;"ps2ip_init ok.\n"&#41;;

  int sck = socket &#40;PF_INET, SOCK_STREAM, 0&#41;;
  if &#40;!&#40;sck < 0&#41;&#41;
    &#123;
      ...
when ran via PS2LINK the first printf is shown and then nothing. If I comment-out the ps2ip_init call, socket fails.

PS2 TCP/IP is already initialized by PS2LINK, I can ping the PS2, and, AFAIK I upload ELF file via TCP/IP. Then where is the problem?

Ideas, someone?

Posted: Sat Jul 10, 2004 12:44 pm
by Oobles
because ps2link uses ps2ip already, I don't advise using loading programs that use ps2ip during development. Using Naplink over USB means that you can start ps2ip, ps2smap without there being any collissions of drivers already loaded.

You can try not loading ps2ip and ps2smap and use the version already installed by ps2link. If you are making socket calls from EE, you may need to load ps2ips if ps2link doesn't load it already.

Posted: Sat Jul 10, 2004 7:09 pm
by Raizor
Rebooting the IOP should enable you to use ps2link and Naplink for testing.

raizor

Posted: Sat Jul 10, 2004 7:53 pm
by 606u
Oobles: Thanks. Now, I execute test program via PS2LINK (it loads poweroff.irx, iomanx.irx, ps2dev9.irx and ps2ips.irx), and I'm able to connect to the server socket (with telnet and with a test program), but I cannot receive the data I've sent (got zeroes instead). I can also ping the PS2.

ps2client output:

Code: Select all

loadelf&#58; fname host&#58;tcpip_test.elf secname all
Input ELF format filename = host&#58;tcpip_test.elf
0 00100000 0003c328 ....
Loaded, host&#58;tcpip_test.elf
start address 0x100008
gp address 00000000
Loading SIO2MAN
loadmodule&#58; fname rom0&#58;SIO2MAN args 0 arg
loadmodule&#58; id 33, ret 1
Loading MCMAN
loadmodule&#58; fname rom0&#58;MCMAN args 0 arg
loadmodule&#58; id 34, ret 1
Loading MCSERV
loadmodule&#58; fname rom0&#58;MCSERV args 0 arg
loadmodule&#58; id 35, ret 1
Loading XPADMAN
loadmodule&#58; fname rom0&#58;XPADMAN args 0 arg
Pad Driver for OSD &#40;2000/12/05 18&#58;05&#41; 392, 128
loadmodule&#58; id 36, ret 0
Loading poweroff.irx 2137 bytes
Loading iomanx.irx 7417 bytes
Loading ps2dev9.irx 9429 bytes

DEV9 device driver v1.0 - Copyright &#40;c&#41; 2003 Marcus R. Brown

dev9_driver&#58; CXD9611 &#40;Expansion Bay type&#41; initialized.
Loading ps2ips.irx 5813 bytes
PS2IPS&#58; Module Loaded.
PS2IPS&#58; RPC Thread Started
calling ps2ip_init...
ps2ip_init ok.
socket ok.
bind ok.
Server listening on port 23.
14 bytes sent.
14 bytes sent.
14 bytes sent.
14 bytes sent.
14 bytes sent.
14 bytes sent.
14 bytes sent.
14 bytes sent.
14 bytes sent.
14 bytes sent.
Poweroff!!!!
However, if I execute the same app via napClient (it loads poweroff.irx, iomanx.irx, ps2dev9.irx, ps2ip.irx, ps2snap.irx with arguments and ps2ips.irx) I cannot either ping the PS2 or to connect to it via telnet.

napClient log:

Code: Select all

loadelf&#58; fname host&#58;/exec/elf secname all
loadelf version 3.30
Input ELF format filename = host&#58;/exec/elf
0 00100000 0003c328 ....
Loaded, host&#58;/exec/elf
start address 0x100008
gp address 00000000
read/write allocate memory 4000
Loading SIO2MAN
loadmodule&#58; fname rom0&#58;SIO2MAN args 0 arg 
loadmodule&#58; id 27, ret 0
Loading MCMAN
loadmodule&#58; fname rom0&#58;MCMAN args 0 arg 
loadmodule&#58; id 28, ret 0
Loading MCSERV
loadmodule&#58; fname rom0&#58;MCSERV args 0 arg 
loadmodule&#58; id 29, ret 0
Read IPCONFIG.DAT
open name mc0&#58;/SYS-CONF/IPCONFIG.DAT flag 1 data 44978
open fd = -4
Loading XPADMAN
loadmodule&#58; fname rom0&#58;XPADMAN args 0 arg 
Pad Driver for OSD &#40;2000/12/05 18&#58;05&#41; 392, 128
loadmodule&#58; id 30, ret 0
Loading poweroff.irx 2137 bytes
loadbuffer&#58; addrres 4d700 args 0 arg 
loadbuffer&#58; id 31, ret 0
Loading iomanx.irx 7417 bytes
loadbuffer&#58; addrres 8c100 args 0 arg 
loadbuffer&#58; id 32, ret 0
Loading ps2dev9.irx 9429 bytes
loadbuffer&#58; addrres 8f600 args 0 arg 

DEV9 device driver v1.0 - Copyright &#40;c&#41; 2003 Marcus R. Brown

dev9_driver&#58; CXD9611 &#40;Expansion Bay type&#41; initialized.
dev9_driver&#58; Driver loaded.
loadbuffer&#58; id 33, ret 0
Loading ps2ip.irx 78909 bytes
loadbuffer&#58; addrres 8f600 args 0 arg 
loadbuffer&#58; id 34, ret 0
Loading ps2smap.irx 19533 bytes
loadbuffer&#58; addrres 8f600 args 40 arg 192.168.0.100
SMAP&#58; argc 4
SMAP&#58; 192.168.0.100 255.255.255.0 192.168.0.1
loadbuffer&#58; id 35, ret 0
Loading ps2ips.irx 5813 bytes
loadbuffer&#58; addrres 8f600 args 0 arg 
PS2IPS&#58; Module Loaded.
PS2IPS&#58; RPC Thread Started
loadbuffer&#58; id 36, ret 0
calling ps2ip_init...
ps2ip_init ok.
socket ok.
bind ok.
Server listening on port 23.
Raizor: Thanks for the reply, but how to do that? :-)

PS: I've published the sources here: tcpip_test.c, Makefile

Posted: Thu Jul 22, 2004 3:44 am
by 606u
Can you, at least, direct me where to find a working streaming TCP/IP sockets for EE source? Thanks.

Posted: Sat Jul 24, 2004 6:42 am
by 606u
Just in case anyone cares: ps2ip.irx (2004-05-02, 78909 bytes long) and ps2ips.irx (2004-05-02, 5813 bytes long) from ps2sdk-v1.0alpha-bin.zip doesn't seems to work on my setup. Replacing this file with ps2ip.irx (2004-01-01, 68189 bytes long) and ps2ips.irx (2003-12-31, 8661 bytes long) taken from ps2link binary fixes the problem.