KallistiOS (Homebrew) modem support

Place for discussing homebrew games, development, new releases and emulation.

Moderator: VasiliyRS

User avatar
BlueCrab
Developer
Posts: 761

KallistiOS (Homebrew) modem support

Post#1 » Thu Jun 05, 2014 9:37 pm

I don't really know if there's many coders who are around over here who don't hang around at DCEmulation as well, but just in case, I figured I'd post this here too... Yes, I'm lazy and copy/pasted it from my post there. ;)

This evening, I have finally finished working on one of the most requested features that had been missing from KOS for all these years -- the ability to use the modem to connect to the Internet. KOS has had support for using the modem itself for a long time (the current modem driver was added around ten years ago now), but there hasn't ever been a working way of actually using that with the network stack. Until now, of course.

I had first started working on a PPP library about 7 years ago, only to shelve it for various reasons, including the inability to actually test it to see if it worked. Well, about 2 weeks ago, I decided to pick up where I left off, and restart work on a PPP library. Most of the code has been written in that 2 week span, although there are some bits and pieces from my old library from 2007. The library itself contains support code for using PPP over both the modem and over a coder's cable, and is fully linked in with the IPv4 portion of the network stack (no IPv6 support just yet, but I'll probably do that at some point, just for completeness). I've tested using the library to connect to a Raspberry Pi over the coder's cable (USB, obviously), and to connect to a Netopia R2020 router over the modem with success on both counts.

What I'd like is if people who might have a coder's cable of some sort and a Dreamcast modem laying around might be able to test out the library with a real Dialup ISP. That's the one thing I haven't been able to test the code with as of yet that I'd like to have done. If you want to do so, first make sure you have your git copy of KOS up-to-date, re-run make to build libppp (it's in the addons tree) and the other assorted updates to the repo, and then compile the following program ("kos-cc -o ppptest.elf ppptest.c -lppp" will do the trick, assuming of course that you name the file ppptest.c):

Code: Select all

#include <stdio.h>
#include <kos/dbglog.h>

#include <arch/arch.h>

#include <ppp/ppp.h>
#include <kos/net.h>

KOS_INIT_FLAGS(INIT_DEFAULT | INIT_NET);

int main(int argc, char *argv[]) {
    int i;

    ppp_init();

    i = ppp_modem_init("12", 1, NULL);
    if(i < 0)
        return 0;

    ppp_set_login("dream", "cast");
    i = ppp_connect();

    if(i == -1) {
        printf("Link establishment failed!\n");
        return 0;
    }

    printf("Pinging the other side of the link (%d.%d.%d.%d)\n",
           net_default_dev->gateway[0], net_default_dev->gateway[1],
           net_default_dev->gateway[2], net_default_dev->gateway[3]);

    for(i = 0; i < 10; ++i) {
        net_icmp_send_echo(net_default_dev, net_default_dev->gateway, 1234, i,
                           NULL, 0);
        thd_sleep(500);
    }

    printf("Pinging sylverant.net (67.222.144.120)\n");
    for(i = 0; i < 10; ++i) {
        uint8 addr[4] = { 67, 222, 144, 120 };
        net_icmp_send_echo(net_default_dev, addr, 1234, i, NULL, 0);
        thd_sleep(500);
    }

    ppp_shutdown();
    return 0;
}


You'll probably want to change the phone number (the first argument to ppp_modem_init()), and the username/password pair (ppp_set_login()).

User avatar
Impulse
Admin
Posts: 2084

Re: KallistiOS (Homebrew) modem support

Post#2 » Thu Jun 05, 2014 11:58 pm

Thanks for posting! Great to hear modem support has been added. I might be able to test it but my VOIP phone service might not work with a real dial up ISP.
-Impulse

User avatar
BlueCrab
Developer
Posts: 761

Re: KallistiOS (Homebrew) modem support

Post#3 » Fri Jun 06, 2014 12:14 am

From what I've heard, VoIP providers sometimes will work (depending on the compression scheme they use), but it'll usually be exceedingly slow. Not that that actually matters in this case. ;-)

  • Similar Topics
    Replies
    Views
    Last post

Return to “New Releases/Homebrew/Emulation”

Who is online

Users browsing this forum: No registered users