Megalextoria
Retro computing and gaming, sci-fi books, tv and movies and other geeky stuff.

Home » Digital Archaeology » Computer Arcana » Commodore » Commodore 8-bit » Using tcpser on a Pi for telnet gateway to C64?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Using tcpser on a Pi for telnet gateway to C64? [message #340094] Thu, 23 March 2017 21:00 Go to next message
Jimmy Mac is currently offline  Jimmy Mac
Messages: 36
Registered: December 2011
Karma: 0
Member
Hi all,

I've struggled to find much in the way of solid documentation on how to get tcpser to autostart on the Raspberry Pi. Anyone have a quick easy solution?
I blame my 30 years of Microsoft on my Linux ignorance but I'm evolving :-)

Trying to resurrect (rebuild) a C46 BBS. No problems getting tcpser to work from ssh or local terminal, just can't get any of the examples I've read about to work on the Pi.

TIA!

Jim..
Re: Using tcpser on a Pi for telnet gateway to C64? [message #340139 is a reply to message #340094] Fri, 24 March 2017 14:48 Go to previous messageGo to next message
Andreas Kohlbach is currently offline  Andreas Kohlbach
Messages: 1456
Registered: December 2011
Karma: 0
Senior Member
On Thu, 23 Mar 2017 18:00:42 -0700 (PDT), Jimmy Mac wrote:
>
> I've struggled to find much in the way of solid documentation on how
> to get tcpser to autostart on the Raspberry Pi.

Why? Does your BBS need this?

> Anyone have a quick easy solution? I blame my 30 years of Microsoft on
> my Linux ignorance but I'm evolving :-)

I never had any Raspberrys Linuxes but most Linux distributions know
"service", or when they have systemd also "systemctrl".

Try something like

service tcpser enable

as root. That might take care of having it started on each boot from then
on.

The name might be different to tcpser thought. Have a look into
/etc/init.d/ for possible candidates.

ls /etc/init.d/
--
Andreas
You know you are a redneck if
you had to remove a toothpick for wedding pictures.
Using tcpser on a Pi for telnet gateway to C64? [message #340188 is a reply to message #340094] Fri, 24 March 2017 06:45 Go to previous messageGo to next message
Anonymous
Karma:
Originally posted by: nospam.Drew.Klenotic

On 23 Mar 17 18:00:42 Jimmy Mac wrote...

JM> Hi all,
JM>
JM> I've struggled to find much in the way of solid documentation on how
JM> to get tcpser to autostart on the Raspberry Pi. Anyone have a quick
JM> easy solution? I blame my 30 years of Microsoft on my Linux ignorance
JM> but I'm evolving :-)
JM>
JM> Trying to resurrect (rebuild) a C46 BBS. No problems getting tcpser
JM> to work from ssh or local terminal, just can't get any of the
JM> examples I've read about to work on the Pi.
JM>
JM> TIA!
JM>
JM> Jim..
JM>
JM> --- SoupGate-Win32 v1.05 * Origin: Agency HUB, Dunedin - New Zealand
JM> | Fido<>Usenet Gateway (3:770/3)

To which Drew Klenotic replies...

Why re-invent the wheel? http://www.particles.org/particlesbbs/ is a
C128 BBS on "the net". This guy is probably one of the best examples of
a great old school retro BBS. He literally has more activity in a day
than I have in weeks. He's the guy we're all wishing we were.

Check in with him. I'm sure he'd be happy to help. If not, I'd be happy
to help (I'm an Atari guy, but the basic principles are the same).

Also on Facebook. https://www.facebook.com/particlesbbs/
Re: Using tcpser on a Pi for telnet gateway to C64? [message #340785 is a reply to message #340094] Thu, 30 March 2017 11:33 Go to previous messageGo to next message
Anonymous
Karma:
Originally posted by: CBMGuy

On Thursday, March 23, 2017 at 7:00:43 PM UTC-6, Jimmy Mac wrote:
> Hi all,
>
> I've struggled to find much in the way of solid documentation on how to get tcpser to autostart on the Raspberry Pi. Anyone have a quick easy solution?


Hey there. I just did this for an old Atari STe I fixed and wanted to BBS. I have an old Raspberry Pi Model B and a MAX232 serial 9pin for the PI (it's about $1.50 for the MAX232 from ebay--I have a number of these already which is why I used them for the project). I hooked the Pi up to the Pi's GPIO port. The only issue with this setup is that the Pi monitors that port for remote logins and yo need to disable that function. You can use raspi-config to change those settings. If you are using a USB to serial adaptor, you can skip this and hop down to the automated service in LINUX section below.

To turn the GPIO header for serial:

Type at the bash: sudo raspi-config

Selected option 5 from the menu, then selected Serial from that menu. Choose No to the login shell over serial. Then yes to enabling the serial port hardware. exit out of the tool and back to the bash.

Physical connections from the Max232 to the PI GPIO:

MAX232 Pi GPOI
Vcc 3.3V pin 2
GND GND pin 6
Tx Rx pin 10
Rx Tx pin 8

Setting up to automate tcpser on boot:

Create a text file (I just put it in the home directory) and make it executable. At the bash:

type: cd <Enter>
type: vi serialBridge <Enter>
type: i
type: #!/bin/sh <Enter>
type: tcpser -s 19200 -d /dev/ttyAMA0 &
type <Esc>:wq <Enter>

you're now out of the editor and back at the bash.

type: chmod +x serialBridge

that will make the file executable (like a batch file in DOS). Change the 19200 baud rate to whatever you need it to be.

You need to create another text file that instructs LINUX a service is available. To do that, we create another text file in a very specific spot and then issue some commands to tell LINUX to use it when it's booting. to do that:

type: vi /lib/systemd/system/serialBridge.service <Enter>
type: i

copy and paste everything between the # marks into the editor:

####################
[Unit]
Description=Serial to TCP-IP Bridge
After=Multi-User.target

[Install]
WantedBy=Multi-user.target

[Service]
ExecStart=/home/pi/serialBridge
type=forked
#####################

You're still in the editor:
type: <Esc>:wq <Enter>

You will now be out of the editor and at the bash prompt.

type: sudo systemctl enable serialBridge.service
type: sudo systemctl start serialBridge.service
type: sudo systemctl status serialBridge.service

The first command will instruct LINUX the service should be enabled at boot (level 3). The second command will tell LINUX to start the service right now. The third command will just display the status of the service we just started with the previous command.

Run a terminal, turn flow control off, set the baud rate proper and "ATDT dnsName:port" in the term and you're good to go. Enjoy :)

*If you have any problems, please let me know and I'll be glad to help. I have the pictures and such on my facebook page blogging the project I just did.

One thing I'd like to note is that I thought tcpser, by default, used RTS/CTS flow control. I had to disable the flow control on the Atari before any data came through... I'm not sure if this is due to the buggy serial port or just something I have overlooked.... Just a head's up in case you do not see anything going through.

Cheers,
Carl
Re: Using tcpser on a Pi for telnet gateway to C64? [message #340786 is a reply to message #340785] Thu, 30 March 2017 11:36 Go to previous messageGo to next message
Anonymous
Karma:
Originally posted by: CBMGuy

On Thursday, March 30, 2017 at 9:33:46 AM UTC-6, CBMGuy wrote:
> On Thursday, March 23, 2017 at 7:00:43 PM UTC-6, Jimmy Mac wrote:
>> Hi all,
>>
>> I've struggled to find much in the way of solid documentation on how to get tcpser to autostart on the Raspberry Pi. Anyone have a quick easy solution?
>
>
> Hey there. I just did this for an old Atari STe I fixed and wanted to BBS. I have an old Raspberry Pi Model B and a MAX232 serial 9pin for the PI (it's about $1.50 for the MAX232 from ebay--I have a number of these already which is why I used them for the project). I hooked the Pi up to the Pi's GPIO port. The only issue with this setup is that the Pi monitors that port for remote logins and yo need to disable that function. You can use raspi-config to change those settings. If you are using a USB to serial adaptor, you can skip this and hop down to the automated service in LINUX section below.
>
> To turn the GPIO header for serial:
>
> Type at the bash: sudo raspi-config
>
> Selected option 5 from the menu, then selected Serial from that menu. Choose No to the login shell over serial. Then yes to enabling the serial port hardware. exit out of the tool and back to the bash.
>
> Physical connections from the Max232 to the PI GPIO:
>
> MAX232 Pi GPOI
> Vcc 3.3V pin 2
> GND GND pin 6
> Tx Rx pin 10
> Rx Tx pin 8
>
> Setting up to automate tcpser on boot:
>
> Create a text file (I just put it in the home directory) and make it executable. At the bash:
>
> type: cd <Enter>
> type: vi serialBridge <Enter>
> type: i
> type: #!/bin/sh <Enter>
> type: tcpser -s 19200 -d /dev/ttyAMA0 &
> type <Esc>:wq <Enter>
>
> you're now out of the editor and back at the bash.
>
> type: chmod +x serialBridge
>
> that will make the file executable (like a batch file in DOS). Change the 19200 baud rate to whatever you need it to be.
>
> You need to create another text file that instructs LINUX a service is available. To do that, we create another text file in a very specific spot and then issue some commands to tell LINUX to use it when it's booting. to do that:
>
> type: vi /lib/systemd/system/serialBridge.service <Enter>
> type: i
>
> copy and paste everything between the # marks into the editor:
>
> ####################
> [Unit]
> Description=Serial to TCP-IP Bridge
> After=Multi-User.target
>
> [Install]
> WantedBy=Multi-user.target
>
> [Service]
> ExecStart=/home/pi/serialBridge
> type=forked
> #####################
>
> You're still in the editor:
> type: <Esc>:wq <Enter>
>
> You will now be out of the editor and at the bash prompt.
>
> type: sudo systemctl enable serialBridge.service
> type: sudo systemctl start serialBridge.service
> type: sudo systemctl status serialBridge.service
>
> The first command will instruct LINUX the service should be enabled at boot (level 3). The second command will tell LINUX to start the service right now. The third command will just display the status of the service we just started with the previous command.
>
> Run a terminal, turn flow control off, set the baud rate proper and "ATDT dnsName:port" in the term and you're good to go. Enjoy :)
>
> *If you have any problems, please let me know and I'll be glad to help. I have the pictures and such on my facebook page blogging the project I just did.
>
> One thing I'd like to note is that I thought tcpser, by default, used RTS/CTS flow control. I had to disable the flow control on the Atari before any data came through... I'm not sure if this is due to the buggy serial port or just something I have overlooked.... Just a head's up in case you do not see anything going through.
>
> Cheers,
> Carl

I forgot to mention that if you are using an USB to Serial adaptor, Everything is the same in the LINUX setup except the tcpser device would be ttyUSB0. not ttyAMA0. Sorry for missing that info.

Cheers,
Carl
Re: Using tcpser on a Pi for telnet gateway to C64? [message #340787 is a reply to message #340785] Thu, 30 March 2017 12:50 Go to previous messageGo to next message
Anonymous
Karma:
Originally posted by: CBMGuy

On Thursday, March 30, 2017 at 9:33:46 AM UTC-6, CBMGuy wrote:
> On Thursday, March 23, 2017 at 7:00:43 PM UTC-6, Jimmy Mac wrote:
>> Hi all,
>>
>> I've struggled to find much in the way of solid documentation on how to get tcpser to autostart on the Raspberry Pi. Anyone have a quick easy solution?
>
>
> Hey there. I just did this for an old Atari STe I fixed and wanted to BBS. I have an old Raspberry Pi Model B and a MAX232 serial 9pin for the PI (it's about $1.50 for the MAX232 from ebay--I have a number of these already which is why I used them for the project). I hooked the Pi up to the Pi's GPIO port. The only issue with this setup is that the Pi monitors that port for remote logins and yo need to disable that function. You can use raspi-config to change those settings. If you are using a USB to serial adaptor, you can skip this and hop down to the automated service in LINUX section below.
>
> To turn the GPIO header for serial:
>
> Type at the bash: sudo raspi-config
>
> Selected option 5 from the menu, then selected Serial from that menu. Choose No to the login shell over serial. Then yes to enabling the serial port hardware. exit out of the tool and back to the bash.
>
> Physical connections from the Max232 to the PI GPIO:
>
> MAX232 Pi GPOI
> Vcc 3.3V pin 2
> GND GND pin 6
> Tx Rx pin 10
> Rx Tx pin 8
>
> Setting up to automate tcpser on boot:
>
> Create a text file (I just put it in the home directory) and make it executable. At the bash:
>
> type: cd <Enter>
> type: vi serialBridge <Enter>
> type: i
> type: #!/bin/sh <Enter>
> type: tcpser -s 19200 -d /dev/ttyAMA0 &
> type <Esc>:wq <Enter>
>
> you're now out of the editor and back at the bash.
>
> type: chmod +x serialBridge
>
> that will make the file executable (like a batch file in DOS). Change the 19200 baud rate to whatever you need it to be.
>
> You need to create another text file that instructs LINUX a service is available. To do that, we create another text file in a very specific spot and then issue some commands to tell LINUX to use it when it's booting. to do that:
>
> type: vi /lib/systemd/system/serialBridge.service <Enter>
> type: i
>
> copy and paste everything between the # marks into the editor:
>
> ####################
> [Unit]
> Description=Serial to TCP-IP Bridge
> After=Multi-User.target
>
> [Install]
> WantedBy=Multi-user.target
>
> [Service]
> ExecStart=/home/pi/serialBridge
> type=forked
> #####################
>
> You're still in the editor:
> type: <Esc>:wq <Enter>
>
> You will now be out of the editor and at the bash prompt.
>
> type: sudo systemctl enable serialBridge.service
> type: sudo systemctl start serialBridge.service
> type: sudo systemctl status serialBridge.service
>
> The first command will instruct LINUX the service should be enabled at boot (level 3). The second command will tell LINUX to start the service right now. The third command will just display the status of the service we just started with the previous command.
>
> Run a terminal, turn flow control off, set the baud rate proper and "ATDT dnsName:port" in the term and you're good to go. Enjoy :)
>
> *If you have any problems, please let me know and I'll be glad to help. I have the pictures and such on my facebook page blogging the project I just did.
>
> One thing I'd like to note is that I thought tcpser, by default, used RTS/CTS flow control. I had to disable the flow control on the Atari before any data came through... I'm not sure if this is due to the buggy serial port or just something I have overlooked.... Just a head's up in case you do not see anything going through.
>
> Cheers,
> Carl

SOB. I missed one thing that will bugger you up creating the .service file.. you need to be root and I forgot the sudo prefix in the step... Enter sudo vi /lib/systemd/system/serialBridge.service <Enter>

sorry for the snafu... I'm really buggering this up. My memory seems to be pretty buggy lately. If it means anything, I've taken my break at work to create a proper text file and also included a wireless WIFI setup to make it free of the extra cabling. Let me know if you would like that doc.

Cheers,
carl
Re: Using tcpser on a Pi for telnet gateway to C64? [message #340788 is a reply to message #340094] Thu, 30 March 2017 14:17 Go to previous messageGo to next message
Jimmy Mac is currently offline  Jimmy Mac
Messages: 36
Registered: December 2011
Karma: 0
Member
On Thursday, March 23, 2017 at 6:00:43 PM UTC-7, Jimmy Mac wrote:
> Hi all,
>
> I've struggled to find much in the way of solid documentation on how to get tcpser to autostart on the Raspberry Pi. Anyone have a quick easy solution?
> I blame my 30 years of Microsoft on my Linux ignorance but I'm evolving :-)
>
> Trying to resurrect (rebuild) a C46 BBS. No problems getting tcpser to work from ssh or local terminal, just can't get any of the examples I've read about to work on the Pi.
>
> TIA!
>
> Jim..

Carl! You ROCK! I hadn't even considered the MAX232 method. I've been using a serial to USB cable and a Commodore 1011 RS-232 cart. No worries on root. I would have done that anyway. Many thanks!

I may just have to break down and try this with the Max232 with a new Pi Zero W. Nice small package.

J..
Re: Using tcpser on a Pi for telnet gateway to C64? [message #340789 is a reply to message #340139] Thu, 30 March 2017 14:19 Go to previous messageGo to next message
Jimmy Mac is currently offline  Jimmy Mac
Messages: 36
Registered: December 2011
Karma: 0
Member
On Friday, March 24, 2017 at 11:48:33 AM UTC-7, Andreas Kohlbach wrote:
> On Thu, 23 Mar 2017 18:00:42 -0700 (PDT), Jimmy Mac wrote:
>>
>> I've struggled to find much in the way of solid documentation on how
>> to get tcpser to autostart on the Raspberry Pi.
>
> Why? Does your BBS need this?
>
Yep. Going old-school with a physical Commodore C64. Thanks for the tips.
Re: Using tcpser on a Pi for telnet gateway to C64? [message #340790 is a reply to message #340188] Thu, 30 March 2017 14:21 Go to previous messageGo to next message
Jimmy Mac is currently offline  Jimmy Mac
Messages: 36
Registered: December 2011
Karma: 0
Member
On Saturday, March 25, 2017 at 2:23:05 AM UTC-7, Drew Klenotic wrote:

>
> Why re-invent the wheel? http://www.particles.org/particlesbbs/ is a
> C128 BBS on "the net". This guy is probably one of the best examples of
> a great old school retro BBS. He literally has more activity in a day
> than I have in weeks. He's the guy we're all wishing we were.
>
> Check in with him. I'm sure he'd be happy to help. If not, I'd be happy
> to help (I'm an Atari guy, but the basic principles are the same).
>
> Also on Facebook. https://www.facebook.com/particlesbbs/

Not really trying to re-invent, more like adding a Buggy hub & spoke wheel on a VW :-)

I haven't called Particles yet but will certainly do so in the future.
J..
Re: Using tcpser on a Pi for telnet gateway to C64? [message #340791 is a reply to message #340788] Thu, 30 March 2017 14:44 Go to previous messageGo to next message
Anonymous
Karma:
Originally posted by: CBMGuy

On Thursday, March 30, 2017 at 12:17:40 PM UTC-6, Jimmy Mac wrote:
> On Thursday, March 23, 2017 at 6:00:43 PM UTC-7, Jimmy Mac wrote:
>> Hi all,
>>
>> I've struggled to find much in the way of solid documentation on how to get tcpser to autostart on the Raspberry Pi. Anyone have a quick easy solution?
>> I blame my 30 years of Microsoft on my Linux ignorance but I'm evolving :-)
>>
>> Trying to resurrect (rebuild) a C46 BBS. No problems getting tcpser to work from ssh or local terminal, just can't get any of the examples I've read about to work on the Pi.
>>
>> TIA!
>>
>> Jim..
>
> Carl! You ROCK! I hadn't even considered the MAX232 method. I've been using a serial to USB cable and a Commodore 1011 RS-232 cart. No worries on root. I would have done that anyway. Many thanks!
>
> I may just have to break down and try this with the Max232 with a new Pi Zero W. Nice small package.
>
> J..

If you use the Zero with a headless Raspbian, than it will work perfectly; fast, responsive, and boot quickly. I used an older 2011 Model B (which is practically the same as the Zero) with the above project and it works great.

If you would rather have the more thought out text file I wrote, then let me know and I'll post it or send it or whatever... It's bothering me so I probably will just repost the complete and corrected instructions here... It make much more sense than the semi-babble-blog instructions above.

Worth noting, the MAX232 will work every time. The USB to Serial adapters are not all the same and many work while many other adapters will not... It's worth spending the $1.50 on a MAX232 and just get it done without the headaches.

Cheers,
Carl
Re: Using tcpser on a Pi for telnet gateway to C64? [message #340792 is a reply to message #340094] Thu, 30 March 2017 14:48 Go to previous messageGo to next message
Anonymous
Karma:
Originally posted by: CBMGuy

Ya, the previous post is bugging the hecj out of me and I really don't want ppl to be frustrated if they follow it. Here's a more easy to follow procedure without the missing parts. It also includes a wifi part that will help in making a wifi Pi easier to setup, as well.

Sorry for the double posting and such... Such an 80's thing to do!




Emulating a serial modem on a Raspberry Pi
C. Reilly 30MARCH2017

This quick little project will provide a serial to tcp/ip bridge for a Raspberry Pi LINUX using tcpser and a MAX232 (or a USB to Serial adaptor). TCPSER will emulate the important Hayes commands needed to connect to telnet BBSs.

It's a great way to BBS again. Can be used from the UserPort or a swiftlink/turbo 232 and even stand up a Q-Link server and connect to it with real hardware.

TOC
---
Manditory Step - Setting up the environment properly
Step 1 - Connecting the MAX232 (if you are using a USB to Serial adaptor, skip this step)
Step 2 - Automating tcpser to start when booting the Pi
Step 3 - Setting up a wireless Pi connection without a GUI
---


Manditory Step - Setting up the environment
---
First, install Raspbian onto your Pi. I use a headless version of raspbian LINUX making it pretty light weight, fast booting and responsive. Connect an active ethernet cable and make sure you have a network connection.

Default Username: pi
Default password: raspberry



Second, note the IP address of your Pi. This is used to access the Pi for programming and maintenance. I use my router to provide the IP address and from there, I use PuTTY to telnet into the Pi to perform the rest of these instructions.

If you cannot find the IP address, connect a keyboard and a monitor to the Pi and once it's booted, logon using the default username and password to get to a bash.

Type: ifconfig eth0

Record the IP address. I recommend disconnecting the keyboard and monitor from the Pi before proceding and just remote into the Pi using PuTTY or your favourite telnet client.

If you are using a USB wireless 802.11 connection, see Step 3 to get that working. The wifi is a pretty slick way of using this project, BTW. Power can be taken from the cassette, joyport, etc. and the Pi can be tucked out of the way, giving your computer a lot more freedom and remaining tidy.



Third, install tcpser. At the bash:

type: sudo apt-get install tcpser


**Worth noting, you can use a number of USB to Serial adaptors to allow more than one baud rate/computer to be connected. The expense of power might be an issue, but it will work perfectly fine with multi tcpser commands pointing to specific ttyYUSB hardware.





Step 1 - Connecting the MAX232 (if you are using a USB to Serial adaptor, skip this step)
---
I have an old Raspberry Pi Model B and a MAX232 serial 9pin board for the Pi (it's about $1.50 for the MAX232 from ebay--I have a number of these already which is why I used them for this project). The MAX232 is connected to the Pi's GPIO port. To use the port properly, you need to disable the Pi's default setting that takes control of the poirt to monitor for remote logons. To do that, do the following:

To setup the Pi's GPIO header for serial and disable remote logon monitoring, at the bash:

Type: sudo raspi-config

Select option 5 from the menu, then select Serial from that menu. Choose No to the "login shell over serial". Then yes to "enabling the serial port hardware". While I was in there, I also overclocked the Pi, but if power is an issue, you may want to skip that suggestion. Exit out of the tool and back to the bash. There's no need to reboot the Pi.

Using the four patch wires that come with the MAX232, physically wire it to the Pi's GPIO as follows:

MAX232 Pi GPOI
------ -------
Vcc <---------> 3.3V pin 2
GND <---------> GND pin 6
Tx <---------> Rx pin 10
Rx <---------> Tx pin 8



Step 2 - Setting up the Pi to automate tcpser on boot:
---
Two text files need to be created. One is the executable file that has the instructions to start tcpser with our default values and another text file that instructs LINUX how to start the first file as a bootable service.

1. Create a text file (I just put it in the Pi home directory) and make it executable. If you are using a USB to Serial Adaptor, change the ttyAMA0 to ttyUSB0 in the following instructions (or the ttyUSB# that represents where your adaptor is active using the command: lsusb -t at the bash). Change the 38400 baud rate value in the tcpser line to whatever suites your setup..

To create the proper text file, at the bash:

type: cd <Enter>
type: vi serialBridge <Enter>
type: i
type: #!/bin/sh <Enter>
type: tcpser -s 38400 -d /dev/ttyAMA0 &
type <Esc>:wq <Enter>

You're now out of the editor and back at the bash. If you do an ls command, you should see the new file, serialBridge, in the directory. We now need to make the file executable. At the bash:

type: chmod +x serialBridge

2. Now that we have an executable file to start up tcpser with our default values, we need to create another text file that instructs LINUX how to start that file as a service when the OS boots. To do that, we create another text file in a very specific spot and then issue some commands to tell LINUX to use it when it's booting. To do that, at the bash:

type: sudo vi /lib/systemd/system/serialBridge.service <Enter>
type: i

copy and paste everything between the # mark lines into the editor (or type it in if you are a better typer than myself):

####################
[Unit]
Description=Serial to TCP-IP Bridge
After=Multi-User.target

[Install]
WantedBy=Multi-user.target

[Service]
ExecStart=/home/pi/serialBridge
type=forked
#####################

You're still in the editor at this point, so to save and exit the editor type the following: <Esc>:wq <Enter>

You will now be out of the editor and at the bash prompt. To register the executable as a service and start up the service immediately (no need to reboot), at the bash:

type: sudo systemctl enable serialBridge.service
type: sudo systemctl start serialBridge.service
type: sudo systemctl status serialBridge.service

The first command will instruct LINUX the service should be enabled at boot (level 3). The second command will tell LINUX to start the service right now (so we can use it right away without having to reboot everything). The third command will display the status of the service we just started with the previous command so we can see if it's actually enabled and ready to use. If there is a "disabled" status, then you need to go back and check your typing or if the proper device is being used, etc. If you are using a USB to Serial, the USB0 might have to be changed to ttyUSB1, etc (check to see which one is active).

Physcially connect the MAX232 to your PC with a proper cable. Turn on your PC, fire up a terminal, set the proper baud rate, and enter ATDT followed by the telnet DNS:port. Spank the Return key and see if anything connects and works as expected. I had to disable flow control to work properly, but I believe that's my cable that I was using causing that issue.

Step 3 - Using a Wireless USB 802.11 Adaptor
To connect to your secure wireless network you need to connect a keyboard and monitor to your Pi and perform the following:

type: sudo vi /etc/wpa_supplicant/wpa_supplicant.conf

**Below, wifiName refers to the name of the wifi you are connecting to. wifiPassword is the password you use to connect to your wifi. Include the quotes in your changes below.

Cursor to the bottom of the file:

type: i
type:

network={ ssid="wifiName" psk="wifiPassword"}

now type:
<Esc>:wq<Enter>

You should now be at the bash again. After a couple of moments, the wireless network should be working. It might take a few moments since the Pi has to notice the change you just made and the wifi negotiations need to finish up. It should not take any longer than 5 minutes (2 minutes is a long enough wait, IMHO).

If security is an issue and you do not want your wifi password in plain text like that, then at the bash:

type: sudo wpa_passphrase "wifiName" "wifiPassword"

This will output the encrypted psk token. Replace the psk="wifiPassword" in the wpa_supplicant.conf text-file with the token (this time without the quotes) that was produced with the above command.

Cheers,
Carl
Re: Using tcpser on a Pi for telnet gateway to C64? [message #341267 is a reply to message #340792] Thu, 06 April 2017 20:43 Go to previous messageGo to next message
Anonymous
Karma:
Originally posted by: Dropnine

On Thursday, March 30, 2017 at 12:48:34 PM UTC-6, Dropnine wrote:

I was asked to correct a part that will stop you from automating tcpser on boot. The error is in the type portion of the serialBridge.service text file.

It should be Type=forking. If it's anything else, LINUX will end the thread because it considers the script to have run and maintain its own PID.

Sorry for the error. The serialBridge.service file should look like below.

Edit your original or just type "rm /lib/systemd/systemserialBridge.service" to remove the old file and remake it by doing the following:

type: sudo vi /lib/systemd/system/serialBridge.service <Enter>
type: i

Copy and paste everything between the # mark lines into the editor (or type it in if you are a better typer than myself):

####################
[Unit]
Description=Serial to TCP-IP Bridge
After=Multi-User.target

[Install]
WantedBy=Multi-user.target

[Service]
ExecStart=/home/pi/serialBridge
Type=forking
#####################


..... Cheers
Re: Using tcpser on a Pi for telnet gateway to C64? [message #341268 is a reply to message #341267] Thu, 06 April 2017 21:31 Go to previous messageGo to next message
Anonymous
Karma:
Originally posted by: Dropnine

On Thursday, April 6, 2017 at 6:43:36 PM UTC-6, Dropnine wrote:
> On Thursday, March 30, 2017 at 12:48:34 PM UTC-6, Dropnine wrote:
>
> I was asked to correct a part that will stop you from automating tcpser on boot. The error is in the type portion of the serialBridge.service text file.
>
> It should be Type=forking. If it's anything else, LINUX will end the thread because it considers the script to have run and maintain its own PID.
>
> Sorry for the error. The serialBridge.service file should look like below.
>
> Edit your original or just type "rm /lib/systemd/systemserialBridge.service" to remove the old file and remake it by doing the following:
>
> type: sudo vi /lib/systemd/system/serialBridge.service <Enter>
> type: i
>
> Copy and paste everything between the # mark lines into the editor (or type it in if you are a better typer than myself):
>
> ####################
> [Unit]
> Description=Serial to TCP-IP Bridge
> After=Multi-User.target
>
> [Install]
> WantedBy=Multi-user.target
>
> [Service]
> ExecStart=/home/pi/serialBridge
> Type=forking
> #####################
>
>
> .... Cheers

And... if you're still having an issue, add: Restart=on-abort
after the Type=forking entry.

If you are using a stand-alone lite raspian on your pi, editing the /etc/rc..local file and putting the the tcpser command before the "exit 0" line will also accomplish the autostart on boot. The rc.local file is read-only so you'll need to change the permissions.

Seems to be a few flavours of raspian out there or something is going bonkers... Many ways to do an autoboot, as you can see.
Re: Using tcpser on a Pi for telnet gateway to C64? [message #341293 is a reply to message #340792] Fri, 07 April 2017 11:20 Go to previous messageGo to next message
Anonymous
Karma:
Originally posted by: Dropnine

Step 2 - Making TCPSer a service that boots with the Pi
---
(Edit 5APR2017:
- corrected the .service file contents
- added file permissions to allow tcpser to execute and stay resident at boot
)

So I had a number of pm's stating that their Pi's were not working with the instructions. the service would start manually, but not autostart. This worked fine with my old version of noobs, however I did notice that the latest raspian lite img was, indeed breaking with the previous instructions. The target I set out from in the beginning is to have tcpser run as a *service*. This gives the OS much more flexibility and is not a hack.

I was asked to explain, why make it into a service. There are a number of reasons, but in short, a service is meant to continue on in the event of an error and not stop. The error is directed to a log and you can inspect the status at a level which is approachable. We can check the status of the service with a -l command and it will give us direct info of the error that accurred and we can investigate and correct the error, etc. quickly--which is always the case in my job. It's just a good habit and best practice to get into so that it is much less frustrating.

** You can hack the rc.local file and enter the tcpser command into that to make it autoboot -- make sure you include the & at the end of the command or you'll never get to a login prompt. That is just one issue that may occur when the system hangs at boot. That file is read-only for a reason...but you can use it. There will also be no indication as why the application does not work when it fails and that is a total misery to work through.

** Alternatively, you can also move the serialBridge file into the /etc/init.d/ directory and than issue some commands to enable it; this is more of a brute force sort of approach and requires some programming to do it properly.


So here's the final version and I know this to work as I recreated it last night. I obtained the raspbian lite image and wrote the image to a 4GB SD card. I then booted the Pi, setup my max232 and the GPIO as in step 1. I then installed tcpser as in the mandetory step from the previous instructions. I then went on to document the steps below. I then did the whole process again, this time working from the document below to confirm it was proper.

----
Here is the edited STEP 2 instructions to create tcpser as a service on LINUX (make sure the other steps are followed before going forward with this):

Two text files need to be created. One is the executable file that has the instructions to start tcpser with our default values and another text file that instructs LINUX how to start the first file as a bootable service.

1. Create a text file (I just put it in the Pi home directory) and make it executable. If you are using a USB to Serial Adaptor, change the ttyAMA0 to ttyUSB0 in the following instructions (or the ttyUSB# that represents where your adaptor is active using the command: lsusb -t at the bash). Change the 38400 baud rate value in the tcpser line to whatever suites your setup.. The max232 that I have can go from 300 baud to 115200 baud. There are some that cannot go any lower than 57600, so please make sure you know your type. USB to serial devices are known to be very bad and buggy. Use them at your own risk. My advice is to purchase a USB-Serial device that is more than 10 bucks CDN.

To create the proper text file, at the bash:

type: cd <Enter>
type: vi serialBridge <Enter>
type: i
type: #!/bin/sh <Enter>
type: tcpser -s 38400 -d /dev/ttyAMA0 &
type <Esc>:wq <Enter>

You're now out of the editor and back at the bash. If you do an ls command, you should see the new file, serialBridge, in the directory. We now need to make the file executable. At the bash:

type: chmod +x serialBridge

2. Now that we have an executable file to start up tcpser with our default values, we need to create another text file that instructs LINUX how to start that file as a service when the OS boots. To do that, we create another text file in a very specific spot and then issue some commands to tell LINUX to use it when it's booting. To do that, at the bash:

type: sudo vi /lib/systemd/system/serialBridge.service <Enter>
type: i

Copy and paste everything between the # mark lines into the editor (or type it in if you are a better typer than myself):

####################
[Unit]
Description=Serial to TCP-IP Bridge
After=Multi-User.target

[Install]
WantedBy=Multi-user.target

[Service]
ExecStart=/home/pi/serialBridge
Type=forking
Restart=on-abort
#####################

You're still in the editor at this point, so to save and exit the editor type the following: <Esc>:wq <Enter>

You will now be out of the editor and at the bash prompt. To register the executable as a service and start up the service immediately (no need to reboot), at the bash:

type: sudo chmod 644 /lib/systemd/system/serialBridge.service <ENTER>

type: sudo systemctl daemon-reload
type: sudo systemctl enable serialBridge.service <ENTER>
type: sudo systemctl start serialBridge.service <ENTER>
type: sudo systemctl status serialBridge.service <ENTER>

The first command will reload the daemon server to acknowledge the new changes. The second command will instruct LINUX the service should be enabled at boot (level 3). The third command will tell LINUX to start the service right now (so we can use it right away without having to reboot everything).. The forth command will display the status of the service we just started with the previous command so we can see if it's actually enabled and ready to use. If there is a "disabled" status, then you need to go back and check your typing or if the proper device is being used, etc. If you are using a USB to Serial, the USB0 might have to be changed to ttyUSB1, etc (check to see which one is active).

If your service is not active, then at the bash:

type: sudo systemctl status serialBridge.service -l <ENTER>

and look to see what the issue is. More than likely it'll be a spelling mistake or something simple.

Contact me like before if there are wierd issues with your Pi and these instructions.
Re: Using tcpser on a Pi for telnet gateway to C64? [message #341568 is a reply to message #341293] Wed, 12 April 2017 16:35 Go to previous messageGo to next message
Jimmy Mac is currently offline  Jimmy Mac
Messages: 36
Registered: December 2011
Karma: 0
Member
On Friday, April 7, 2017 at 8:20:23 AM UTC-7, Dropnine wrote:
> Step 2 - Making TCPSer a service that boots with the Pi

Thank you!!

I really appreciate the detailed steps.

Jim..
Re: Using tcpser on a Pi for telnet gateway to C64? [message #342209 is a reply to message #341568] Sun, 11 June 2017 02:13 Go to previous messageGo to next message
Anonymous
Karma:
Originally posted by: 6502enhanced

Hi,

I do have a similar problem with tcpser and the Raspberry PI.

Excuse - it is about a connection between the PI and an Apple II :-) ... hope that's also ok here.

The problem is that tcpser works, but after about 10-20 hours it shuts down. The Terminal Window is still open and I can start it again. Then it is working all right but the same shutdown again after the same time?

My setup:

Raspberry PI 2 Model B
Debian
Raspberry WiFi Stick
USB to serial adapter (USB0)
tcpser
Apple II connected to serial adapter

I installed tcpser with:

sudo apt-get install tcpser

Started tcpser with:

tcpser -s 2400 -d /dev/ttyUSB0 -p 6502 -ts -B /scripts/busy.txt -N /scripts/offline.txt

As said, tcpser is running well, I can telnet to my Apple II - everything works fine. But after a few hours the connection in the Terminal Window is shut down. I start it again - working fine - after a few hours the same?

Thanks for any help!
Re: Using tcpser on a Pi for telnet gateway to C64? [message #342210 is a reply to message #342209] Sun, 11 June 2017 15:40 Go to previous messageGo to next message
Andreas Kohlbach is currently offline  Andreas Kohlbach
Messages: 1456
Registered: December 2011
Karma: 0
Senior Member
On Sat, 10 Jun 2017 23:13:16 -0700 (PDT), 6502enhanced@gmail.com wrote:
>
> I do have a similar problem with tcpser and the Raspberry PI.
>
> Excuse - it is about a connection between the PI and an Apple II :-) ... hope that's also ok here.
>
> The problem is that tcpser works, but after about 10-20 hours it shuts
> down. The Terminal Window is still open and I can start it again. Then
> it is working all right but the same shutdown again after the same
> time?
>
> My setup:
>
> Raspberry PI 2 Model B
> Debian
> Raspberry WiFi Stick
> USB to serial adapter (USB0)
> tcpser
> Apple II connected to serial adapter
>
> I installed tcpser with:
>
> sudo apt-get install tcpser
>
> Started tcpser with:
>
> tcpser -s 2400 -d /dev/ttyUSB0 -p 6502 -ts -B /scripts/busy.txt -N /scripts/offline.txt
>
> As said, tcpser is running well, I can telnet to my Apple II -
> everything works fine. But after a few hours the connection in the
> Terminal Window is shut down. I start it again - working fine - after
> a few hours the same?

Is there a (error) message in the terminal?

If not you could also add "-l 7" which puts out maximal logging messages.
--
Andreas
You know you are a redneck if
there are more fish on your wall than pictures.
Re: Using tcpser on a Pi for telnet gateway to C64? [message #342212 is a reply to message #342210] Mon, 12 June 2017 02:15 Go to previous messageGo to next message
Anonymous
Karma:
Originally posted by: 6502enhanced

Thanks for your help!

No, I get no error message.

I tried to put in -I 7 (tcpser -s 2400 -d /dev/ttyUSB0 -p 6359 -ts -I 7 -B /scripts/busy.txt -N /scripts/offline.txt) - but this leads to another problem: if I try to connect with telnet, the connection to the Apple II is made but closed immediately ...
Using tcpser on a Pi for telnet gateway to C64? [message #342213 is a reply to message #342212] Sun, 11 June 2017 12:16 Go to previous messageGo to next message
Anonymous
Karma:
Originally posted by: nospam.mark.lewis

On 2017 Jun 11 23:15:10, you wrote to All:

en> I tried to put in -I 7

ummm... that should be a lowercase ell... ell for logging ;)

)\/(ark

Always Mount a Scratch Monkey
Do you manage your own servers? If you are not running an IDS/IPS yer doin' it
wrong...
.... We are ready for an unforeseen event that may or may not occur.
Using tcpser on a Pi for telnet gateway to C64? [message #342214 is a reply to message #342213] Mon, 12 June 2017 04:45 Go to previous messageGo to next message
Anonymous
Karma:
Originally posted by: 6502enhanced

Ohh, thanks!

OK that started working good - let's see how long it will last ...
Re: Using tcpser on a Pi for telnet gateway to C64? [message #344772 is a reply to message #342214] Tue, 20 June 2017 03:45 Go to previous messageGo to next message
Anonymous
Karma:
Originally posted by: 6502enhanced

Today I had another stop of tcpser. So it ran now for 8 days without problems.

I don't know why it stopped.

Has anyone an explanation or a hint what I can do?

Here is a pic of the monitor when tcpser stopped:

https://s22.postimg.org/ar4ayh2zl/PI_Hayes.jpg
Re: Using tcpser on a Pi for telnet gateway to C64? [message #345279 is a reply to message #344772] Tue, 20 June 2017 15:47 Go to previous messageGo to next message
Anonymous
Karma:
Originally posted by: Dropnine

On a linux flavour of tcpser:

What log level do you tcpser running at? And is it tracing? Turning logging to verbose/debug (-l 7) and trace some things with the -tis. Force tcpser to dump its output to a file with > output.txt

ie:
tcpser -d /dev/ttyS0 -s 38400 -l 7 -tsSiI > output.txt

You might need to add &1>2 to the end of out output.txt (not too sure since I don't have access to my stuff atm).

Let it run and when it fails, check the output.txt for what happened.

You can also tail the tcpser and see the info as tcpser is running in realtime.

Cheers,
c
Re: Using tcpser on a Pi for telnet gateway to C64? [message #345280 is a reply to message #344772] Tue, 20 June 2017 15:52 Go to previous messageGo to next message
Anonymous
Karma:
Originally posted by: Dropnine

On Tuesday, June 20, 2017 at 1:45:03 AM UTC-6, 6502en...@gmail.com wrote:
> Today I had another stop of tcpser. So it ran now for 8 days without problems.
>
> I don't know why it stopped.
>
> Has anyone an explanation or a hint what I can do?
>
> Here is a pic of the monitor when tcpser stopped:
>
> https://s22.postimg.org/ar4ayh2zl/PI_Hayes.jpg

Just looked at the pic (making that other reply probably repetitive lol sorry) Looks like the socket disappeared. Perhaps there's another service running that is stealing the device or perhaps tcpser is just a little buggy... My two cents.
Re: Using tcpser on a Pi for telnet gateway to C64? [message #345382 is a reply to message #344772] Tue, 20 June 2017 15:56 Go to previous messageGo to next message
Anonymous
Karma:
Originally posted by: Dropnine

On Tuesday, June 20, 2017 at 1:45:03 AM UTC-6, 6502en...@gmail.com wrote:
> Today I had another stop of tcpser. So it ran now for 8 days without problems.
>
> I don't know why it stopped.
>
> Has anyone an explanation or a hint what I can do?
>
> Here is a pic of the monitor when tcpser stopped:
>
> https://s22.postimg.org/ar4ayh2zl/PI_Hayes.jpg

As a hardware solution, how is the pi being powered? From a USB port or from a walled 5V 1A transformer? What is the serial device being used, GPIO or USB to serial?
Re: Using tcpse [message #346091 is a reply to message #342214] Wed, 21 June 2017 07:03 Go to previous messageGo to next message
Anonymous
Karma:
Originally posted by: Ice_Breaker

> oday I had another stop of tcpser. So it ran now for 8 days without problems<
> <
> I don't know why it stopped.<
> <
> as anyone an explanation or a hint what I can do?<
> <
> ere is a pic of the monitor when tcpser stopped:<
> <
> ttps://s22.postimg.org/ar4ayh2zl/PI{CBM-@}Hayes.jpg<
> <

Since I'm on a BBS, I can't see the
JPG, but I always ran TCPSER in a
batch file with a loop command so if it
exited for any reason, it would just
start back up.

...: From Particles! BBS - http://www.particles.org
...: Posted via Netsender 128 v0.90 for Centipede BBS
Re: Using tcpser on a Pi for telnet gateway to C64? [message #346092 is a reply to message #345382] Wed, 21 June 2017 02:09 Go to previous messageGo to next message
Anonymous
Karma:
Originally posted by: 6502enhanced

Thanks for the help!

The PI is being powered by a 5V 1A transformer.

It is connected via a USB to serial adapter to the serial port of a Apple IIe.
Re: Using tcpser on a Pi for telnet gateway to C64? [message #346404 is a reply to message #346092] Wed, 21 June 2017 14:50 Go to previous messageGo to next message
Anonymous
Karma:
Originally posted by: Dropnine

On Wednesday, June 21, 2017 at 12:09:36 AM UTC-6, 6502en...@gmail.com wrote:
> Thanks for the help!
>
> The PI is being powered by a 5V 1A transformer.
>
> It is connected via a USB to serial adapter to the serial port of a Apple IIe.

The USB to serial are known to be sort of flaky... Saying that, the hardware should be powered fine with that power source you have.

If you set it up as a service, it should restart automatically if you told it to in the service file.

To find out if tcpser is still running after it craps out, at the bash type:
ps -ef | grep tcpser

If the resulting list displays that it is still running, then kill it by its PID. Don't confuse the "grep tcpser" in the list as the tcpser command, itself.

If it is not running, then I'd write a quick script that will perform that ps command above and if tcpser does not exist, then start it. Put an entry in your CRON to run that script every 5 minutes or quicker.

Still, the best practice would be to make a tcpser service and tell the service to restart on termination.
Re: Using tcpser on a Pi for telnet gateway to C64? [message #346505 is a reply to message #344772] Wed, 21 June 2017 16:40 Go to previous messageGo to next message
Andreas Kohlbach is currently offline  Andreas Kohlbach
Messages: 1456
Registered: December 2011
Karma: 0
Senior Member
On Tue, 20 Jun 2017 00:45:02 -0700 (PDT), 6502enhanced@gmail.com wrote:
>
> Today I had another stop of tcpser. So it ran now for 8 days without problems.
>
> I don't know why it stopped.
>
> Has anyone an explanation or a hint what I can do?
>
> Here is a pic of the monitor when tcpser stopped:
>
> https://s22.postimg.org/ar4ayh2zl/PI_Hayes.jpg

You might be able to bypass tcpser and most of your setup.

I just came around info and a video by LGR from YouTube [1] about the
WIFI232 <http://hackaday.com/2017/06/17/bbsing-with-the-esp8266/>. Which
at one end has an RS-232 adapter you plug into any of your old hardware
(C64, Amiga, Apple ][, Macintosh, RadioShack, Atari, many others from
back of the day. It claims to be a Hayes compatible modem. Then sets up a
serial connection and call a terminal program on the computer (I notice
there is COMMSTAR for many 8bit computers available) and issue AT
commands. Not only "ATD123456" to dial. Also to connect to your WIFI. I
think it was something like "ATESSIDmywifi_source". There is a PDF user
manual in the web some where.

[1] <https://www.youtube.com/watch?v=fsS0E4G310Y>
--
Andreas
You know you are a redneck if
you ever lost a loved one to kudzu.
Re: Using tcpser on a Pi for telnet gateway to C64? [message #346809 is a reply to message #346505] Wed, 21 June 2017 23:06 Go to previous messageGo to next message
Anonymous
Karma:
Originally posted by: Dropnine

#!/bin/sh

RESULT=`ps -a | sed -n /tcpser/p`

if [ "${RESULT:-null}" = null ]; then
tcpser <yourParameters>


On Wednesday, June 21, 2017 at 2:40:43 PM UTC-6, Andreas Kohlbach wrote:
> On Tue, 20 Jun 2017 00:45:02 -0700 (PDT), 6502enhanced@gmail.com wrote:
>>
>> Today I had another stop of tcpser. So it ran now for 8 days without problems.
>>
>> I don't know why it stopped.
>>
>> Has anyone an explanation or a hint what I can do?
>>
>> Here is a pic of the monitor when tcpser stopped:
>>
>> https://s22.postimg.org/ar4ayh2zl/PI_Hayes.jpg
>
> You might be able to bypass tcpser and most of your setup.
>
> I just came around info and a video by LGR from YouTube [1] about the
> WIFI232 <http://hackaday.com/2017/06/17/bbsing-with-the-esp8266/>. Which
> at one end has an RS-232 adapter you plug into any of your old hardware
> (C64, Amiga, Apple ][, Macintosh, RadioShack, Atari, many others from
> back of the day. It claims to be a Hayes compatible modem. Then sets up a
> serial connection and call a terminal program on the computer (I notice
> there is COMMSTAR for many 8bit computers available) and issue AT
> commands. Not only "ATD123456" to dial. Also to connect to your WIFI. I
> think it was something like "ATESSIDmywifi_source". There is a PDF user
> manual in the web some where.
>
> [1] <https://www.youtube.com/watch?v=fsS0E4G310Y>
> --
> Andreas
> You know you are a redneck if
> you ever lost a loved one to kudzu.

There's a number of those devices and they rock :) There's a new internal C128 wifi that someone made, too:

https://www.reddit.com/r/c128/comments/6gb28v/internal_swift link_compatible_wifi_modem/

If you still want to get your tcpser working and then auto-restart when it stops (for whatever reason) just follow these steps (which is explained in my previous post).

Here's a step-by-step on how to autostart tcpser on the raspberry pi (or any LINUX):

log into your raspberry pi.

Now, create a file that will be your script. At the bash:
type: cd
type: startSerial

copy and paste the text between the *'s:

************
#!/bin/sh

RESULT=`ps x |grep -v grep |grep -c "tcpser"`

if [ $RESULT = 0 ]; then
tcpser -s 38400 -d /dev/ttyUSB0 &
************

Change the tcpser parameters to whatever you normally use (minus the debugging and log parameters). Make sure you keep the & at the end of the command line.

The variable RESULT stores the number of tcpser commands running. If it's 0, then run tcpser command. If it's not 0 then exit (meaning that tcpser is already running).

now save and quit the editor by:
Press the <esc> key
type: :wq

you're now at back at the bash. You need to make the file executable. At the bash:

type: chmod +x startSerial

and, again, you're at the bash after pressing <Enter>.

The second part is to make a timer that will run the script every minute. To do that, you edit the CRON Table. Again, it's just another text file and it's just one line. At the bash:

type: crontab -e

if it asks you what editor you want, select 2) nano.

now use the cursor key to scroll all the way down to the last line and enter (or copy/paste the line below):

*/1 * * * * /home/pi/startSerial

The menu at the bottom your display shows you how to exit the editor. Press <CTRL-X>, then Y and finally your <Enter> key to save the text. The above line tells the your pi to run the startSerial script you just wrote every minute. If you want to change it to a slower interval, change the 1 to a 5 for a 5 minute interval, 10 for a 10 minute interval, etc.

To test it, wait a minute and at the bash:

type: ps x |grep -v grep |grep -c "tcpser"

There should be a 1. If it reports a 0, then you need check your typing and make sure you set the startSerial file to execute with chmod +x.

-----
There are many ways to get the job done. The @reboot command also has its merits in starting a file at boot.

works for me :)

Cheers,
Carl
Re: Using tcpser on a Pi for telnet gateway to C64? [message #346810 is a reply to message #346809] Wed, 21 June 2017 23:12 Go to previous messageGo to next message
Anonymous
Karma:
Originally posted by: Dropnine

On Wednesday, June 21, 2017 at 9:06:24 PM UTC-6, Dropnine wrote:
....
> Now, create a file that will be your script. At the bash:
> type: cd
> type: startSerial
....

That should read
type: cd
type: vi startSerial
type: i

Something happened when I posted that and it added a script I wrote at the beginning of the replay and then omitted the above. Sorry about that random interweb gremlin attack on my post.
Re: Using tcpser on a Pi for telnet gateway to C64? [message #346911 is a reply to message #346810] Thu, 22 June 2017 01:10 Go to previous messageGo to next message
Anonymous
Karma:
Originally posted by: Dropnine

Instead of piecing together the posts and the corrections because of my adhd, I put them here to be easily retrieved as a whole.

https://drive.google.com/drive/folders/0B7Y4Lsah28nCem54WnBW YkZ5LTQ

Cheers
c
Using tcpser on a Pi for telnet gateway to C64? [message #347009 is a reply to message #346404] Wed, 21 June 2017 23:29 Go to previous messageGo to next message
Anonymous
Karma:
Originally posted by: nospam.mark.lewis

On 2017 Jun 21 11:50:38, you wrote to 6502en...@gmail.com:

Dr> If the resulting list displays that it is still running, then kill it
Dr> by its PID. Don't confuse the "grep tcpser" in the list as the tcpser
Dr> command, itself.

a little trick to avoid seeing the "grep" line in the output...

ps -ef | grep [t]cpser

;)

)\/(ark

Always Mount a Scratch Monkey
Do you manage your own servers? If you are not running an IDS/IPS yer doin' it
wrong...
.... "This chicken has no beak," said Tom impeccably.
Re: Using tcpser on a Pi for telnet gateway to C64? [message #347042 is a reply to message #347009] Fri, 23 June 2017 04:55 Go to previous messageGo to next message
Anonymous
Karma:
Originally posted by: 6502enhanced

Hi,
Thanks a lot for all your help!

To explain: I use a Apple IIe for a BBS. Therefor the PI with tcpser acts as a „modem“. So the BBS is reachable via telnet.

I do have a WiFi232 - great tool - I use it to „dial-up“ other BBS with a Apple II+. But I don’t want to purchase a second one , because I have the Raspberry PI 2B and want it to make my BBS connectable via telnet. That worked fine so far - only the mentioned problem …

As I understood correctly I have to do the following to
- make a tcpser service
- That restarts every minute to avoid my problem of tcpser being stopped

1.)
Create a file that will be your script. At the bash:
type: cd
type: vi startSerial
type: i

copy and paste the text between the *'s:

************
#!/bin/sh

RESULT=`ps x |grep -v grep |grep -c "tcpser"`

if [ $RESULT = 0 ]; then
    tcpser -s 2400 -d /dev/ttyUSB0 &
************

2.)
now save and quit the editor by:
Press the <esc> key
type: :wq

3.)
you're now at back at the bash.  You need to make the file executable. At the bash:

type: chmod +x startSerial

and, again, you're at the bash after pressing <Enter>.

4.)
The second part is to make a timer that will run the script every minute.  To do that, you edit the CRON Table. Again, it's just another text file and it's just one line.  At the bash:

type: crontab -e

if it asks you what editor you want, select 2) nano.

now use the cursor key to scroll all the way down to the last line and enter (or copy/paste the line below):

*/1 * * * * /home/pi/startSerial

The menu at the bottom your display shows you how to exit the editor. Press <CTRL-X>, then Y and finally your <Enter> key to save the text.  The above line tells the your pi to run the startSerial script you just wrote every minute.  If you want to change it to a slower interval, change the 1 to a 5 for a 5 minute interval, 10 for a 10 minute interval, etc.

To test it, wait a minute and at the bash:

type: ps x |grep -v grep |grep -c "tcpser"

There should be a 1.  If it reports a 0, then you need check your typing and make sure you set the startSerial file to execute with chmod +x.

———————

Where do I have to put the mentioned:

a little trick to avoid seeing the "grep" line in the output...

  ps -ef | grep [t]cpser

in?


Thanks!
Re: Using tcpser on a Pi for telnet gateway to C64? [message #347051 is a reply to message #347042] Fri, 23 June 2017 10:45 Go to previous messageGo to next message
Anonymous
Karma:
Originally posted by: Dropnine

On Friday, June 23, 2017 at 2:55:55 AM UTC-6, 6502en...@gmail.com wrote:
> Hi,
> Thanks a lot for all your help!
.....
> ———————
>
> Where do I have to put the mentioned:
>
> a little trick to avoid seeing the "grep" line in the output...
>
>   ps -ef | grep [t]cpser
>
> in?
>
>
> Thanks!

That line is just another way of seeing if tcpser is actually running or not without the clutter. You would use that directly at the bash (command prompt) when ever you want to.

In saying that, it's easy to say that there are many many many ways to do one thing lol And that, alone, makes things convoluted and starts many opinions boiling over as to what is the best practice.

So, to start tcpser on boot and to keep it running, you can make it into a server (the proper way I would do it, allowing) *OR* create a timer (just as good as a service, but approached more in the way of an application running on top of the OS rather than within it). It depends on how your brain is used to thinking and whether/what you want to know. The timer requires your own maintenance to be set up (which we did with the script to check it) or letting the OS take care of it all (which is what the service would do)..

Cutting to the chase and getting it done in the least amount of steps and a first crack at it, I would make a timer and then use the @reboot command. Quick, done, and it works: It will autoboot and keep running when it crashes and its process quits.

I also agree with keeping the Pi. I'm in the same bought with a bunch of original 2011 pi's that work great for this purpose. I prefer the max232 and GPIO hardware route, but each to there own :) Working with this stuff makes it all feel like 1984 again :)

Cheers,
Carl
Using tcpser on a Pi for telnet gateway to C64? [message #347055 is a reply to message #347009] Fri, 23 June 2017 01:52 Go to previous messageGo to next message
Anonymous
Karma:
Originally posted by: nospam.Janne.Johansson

On 2017-06-22 21:29, mark lewis : Dropnine wrote:
>
> On 2017 Jun 21 11:50:38, you wrote to 6502en...@gmail.com:
>
> Dr> If the resulting list displays that it is still running, then kill it
> Dr> by its PID. Don't confuse the "grep tcpser" in the list as the tcpser
> Dr> command, itself.
>
> a little trick to avoid seeing the "grep" line in the output...
>
> ps -ef | grep [t]cpser
>

Or just use "pgrep" which saves you the pipe and the tricks.
Re: Using tcpser on a Pi for telnet gateway to C64? [message #347056 is a reply to message #347055] Fri, 23 June 2017 11:19 Go to previous messageGo to next message
Anonymous
Karma:
Originally posted by: Dropnine

On Friday, June 23, 2017 at 9:05:34 AM UTC-6, Janne Johansson wrote:
.....
> Or just use "pgrep" which saves you the pipe and the tricks.

lol. That's another way yup. Again, you'd use that just at the bash as a command in respect to the how-to's provided.
Re: Using tcpser on a Pi for telnet gateway to C64? [message #347142 is a reply to message #347056] Mon, 26 June 2017 11:32 Go to previous messageGo to next message
Anonymous
Karma:
Originally posted by: 6502enhanced

Thanks for your help!

Well, I did all 4 steps, but so far I get always the 0 and not the 1 when I type: ps x |grep -v grep |grep -c "tcpser" ... Especially I made sure that I set the startSerial file to execute with chmod +x ...

I would like to delete the file in script with:
***************
#!/bin/sh

RESULT=`ps x |grep -v grep |grep -c "tcpser"`

if [ $RESULT = 0 ]; then
tcpser -s 2400 -d /dev/ttyUSB0 &
***************
because I have an empty first row above that - maybe here is the mistake?

With what order can I delete the script?

----------------

Towards the WiFi232 - on the BBS - A 80's Apple II BBS ( Telnet: a80sappleiibbs.ddns.net:6502 ) is a discussion about how to host a BBS with the WiFi232 - so far the BBS Software GBBS Pro moves not into answer mode if the Apple II is connected to the WiFi232 - with the Raspberry PI this works without any problems ...
Re: Using tcpser on a Pi for telnet gateway to C64? [message #347153 is a reply to message #347142] Mon, 26 June 2017 14:45 Go to previous messageGo to next message
Anonymous
Karma:
Originally posted by: Dropnine

On Monday, June 26, 2017 at 9:32:58 AM UTC-6, 6502en...@gmail.com wrote:
> Thanks for your help!
>
> Well, I did all 4 steps, but so far I get always the 0 and not the 1 when I type: ps x |grep -v grep |grep -c "tcpser" ... Especially I made sure that I set the startSerial file to execute with chmod +x ...
>
> I would like to delete the file in script with:
> ***************
> #!/bin/sh
>
> RESULT=`ps x |grep -v grep |grep -c "tcpser"`
>
> if [ $RESULT = 0 ]; then
> tcpser -s 2400 -d /dev/ttyUSB0 &
> ***************
> because I have an empty first row above that - maybe here is the mistake?
>
> With what order can I delete the script?
>
> ----------------


Hi. I would think that your CRON is not running or there is something up with the timing job that was entered (That's just a guess). *Make sure that your pi is updated with sudo apt-get update and then sudo apt-get upgrade.

There's a couple of ways to get a picture of what's going on, the first thing is to turn on the cron logging and then look at it's log with the command: less /var/logs/cron.log and see what it is reporting. And then go to correct the spelling or whatever the cause is. Check the doc under "debugging the cron timer" to see how to turn it on.

Another approach is to see if the script,itself, is working. Manually issue the script command with ./startSerial (if that's the name you called your script). Perhaps you never made the text file executable.

Finally, if the script is working, bypass it and manually type: tcpser -s 2400 -d /dev/ttyUSB0 &

at the bash and then issue a "ps -A" the tcpser should be in the list near the bottom. If it is, then issue the ps -x | grep -v grep |grep -c "tcpser" command manually to see the result. That should tell you if the tcpser command is working, itself.
Re: Using tcpser on a Pi for telnet gateway to C64? [message #347154 is a reply to message #347142] Mon, 26 June 2017 14:50 Go to previous messageGo to next message
Anonymous
Karma:
Originally posted by: Dropnine

PS: the script should only contain the following:

#!/bin/sh

RESULT=`ps x |grep -v grep |grep -c "tcpser"`

if [ $RESULT = 0 ]; then
tcpser -s 2400 -d /dev/ttyUSB0 &


Nothing more.

I put the script into a file in the directory. If you need it, you can copy it directly to your pi with a wget command.

CVh
Re: Using tcpser on a Pi for telnet gateway to C64? [message #347269 is a reply to message #347153] Wed, 28 June 2017 09:26 Go to previous messageGo to previous message
Anonymous
Karma:
Originally posted by: 6502enhanced

Am Montag, 26. Juni 2017 20:45:48 UTC+2 schrieb Dropnine:

> Finally, if the script is working, bypass it and manually type: tcpser -s 2400 -d /dev/ttyUSB0 &
>
> at the bash and then issue a "ps -A" the tcpser should be in the list near the bottom. If it is, then issue the ps -x | grep -v grep |grep -c "tcpser" command manually to see the result. That should tell you if the tcpser command is working, itself.

OK, I've done the following:

- wrote "tcpser -s 2400 -d /dev/ttyUSB0 -p 6502 -ts &"
- then ps -A
- and ps -x | grep -v grep |grep -c "tcpser"

(I needed to enter the port 6502 - otherwise there was no connection to the apple II because I set that port for the telnet address which is: a80sappleiibbs.ddns.net:6502 . Without the -ts there was no connection made - I do not know why.)

I saw tcpser down in the list.
I got the 1.
All is running now.

I don't know if the script is working. I named it startSerial, made everything as you said - but if I type "./startSerial" I get the result "unknown error in line 8" ...?

Now I will see if tcpser stops again or if it is running well ...

Thanks a lot for all of your help!
Pages (2): [1  2    »]  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: FREE: Commodore Stuff
Next Topic: Official FAQ comp.binaries.cbm (semimonthly posting)
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Mar 29 05:55:05 EDT 2024

Total time taken to generate the page: 0.19518 seconds