Wednesday, July 31, 2019

How to stream Internet radio stations to your media-system via DLNA with Rygel on Ubuntu 18

My Yamaha RX-V473 recently stopped playing internet radio stations. Yamaha worked with vtuner for this but the vtuner people recently stopped their free service. The Yamaha update to fix this is only for their younger products so the RX-V473 has no new firmware or fix. Yamaha has no clue yet  about Open Source and the many benefits of Open Source so no one will ever be able to fix the problem changing the firmware.

Streaming files from the NAS

The Yamaha RX-V473 has the possibility to access DLNA servers and I had it hooked up to an Ubuntu 18.04.2 LTS with Rygel installed ( sudo apt install rygel ) and media sharing in Ubuntu Settings set to ON.

Rygel options in Ubuntu Settings

Playing your own MP3 files collection is working and easy but I want to listen to SomaFM on my stereo and this option is not (yet) present in the Sharing section of Ubuntu Settings.

Internet radio

To stream SomaFM over DLNA (Rygel) to your DLNA client (Yamaha receiver or any other player) you need to install rygel-gst-launch. Type in terminal:

 sudo apt install rygel-gst-launch

Next: edit rygel.conf. Not just any rygel.conf but the one in /home/$Username$/.config/rygel.conf. (Where $Username$ is your username.)

Go to the section [GstLaunch] and edit the changes as seen below.

I have added the complete relevant section of a working version here.


[GstLaunch]
enabled=true
launch-items=audiotestsrc;soma;drone

audiotestsrc-title=Audiotestsrc

audiotestsrc-mime=audio/x-wav
audiotestsrc-launch=audiotestsrc ! wavenc

soma-title=SomaFM SpaceStation

soma-mime=audio/mp4
soma-launch=souphttpsrc iradio-mode=false location=http://ice2.somafm.com/spacestation-128-aac

drone-title=SomaFM Dronezone

drone-mime=audio/mpeg
drone-launch=souphttpsrc iradio-mode=false location=http://ice2.somafm.com/dronezone-256-mp3


Now when the receiver or any other DLNA compatible client is going to search for DLNA servers under the server button it will see the media share from Rygel and GstLaunch.
Select GstLaunch and 3 radio stations appear:

  Audiotestsrc will produce a test tone for testing.
  SomaFM SpaceStation will play SomaFM Spacestation in 128 bit AAC
  and SomaFM Dronezone will play SomaFM Dronezone in 256 bit MP3

You can add as many internet radio stations as you want.
  • To check if the URL of the stream is working open VLC and go to Media  and then  Networkstream and enter the URL. If VLC starts producing music the URL is correct.
  • Every time you change rygel.conf you need to restart Rygel for the changes to take effect. Restart Rygel in the standard Ubuntu Settings with the Media sharing ON/OFF button.
  • Sometimes the client (The TV, stereo or any mediaplayer) needs to be reset to see changes in the Rygel configuration.
  • To check for error messages stop Rygel with the standard Ubuntu Settings and start Rygel in terminal using the command: 
rygel
        If there are any errors they will be displayed in the terminal. 
  • To install all Gstreamer plugins type in terminal:
sudo apt install gstreamer1.0-*

  • AAC streams have the mime type audio/mp4. MP3 streams have the mime type audio/mpeg.
  • There is no cover art with this setup.
  • Some players accept pls and m3u streams and others do not. I am still trying to figure out why here they do not play.
  • As from SomaFM FAQ "The 128k AAC streams are the best sounding. The 64k AAC-HE streams are a close second, followed by 128k MP3 streams." I do not know where 256 MP3 fits in but my guess is they are the best.

Tuesday, May 21, 2019

How to run pyradmon.py in Systemd on Ubuntu 18.04.2-LTS

pyradmon.py is a little python script I need running to get data from my Geiger counter (GMC-320) to its data showing webpage (Radmon.org).
The script has to always run, also after reboots, outages, changes to the system or the script itself, and it has to be restarted if it fails.
On Ubuntu 18 and many other systems a system called Systemd is in use to facilitate this.

To get the script running in systemd do the following:

Create a file called "radmon.service" in /etc/systemd/system .
[Unit]
Description=Radmon service
After=network.target
StartLimitIntervalSec=0

[Service]
Type=simple
Restart=always
RestartSec=30
User=marc
ExecStart=/usr/bin/python -u /home/marc/GMC/pyradmon.py
StandardOutput=null
StandardError=inherit

[Install]
WantedBy=multi-user.target
Then do:
sudo systemctl enable radmon.service
sudo systemctl start radmon.service
And if needed do:
sudo systemctl status radmon.service
sudo systemctl restart radmon.service
sudo systemctl stop radmon.service
That's it.

Saturday, May 18, 2019

How to enter Ubuntu terminal with an (old) DOS computer and a nullmodem

It is possible to use a DOS computer and enter the Ubuntu terminal via a (serial) nullmodem cable.
Even without any network installed on the DOS computer I can read my mail, browse the web or service the Ubuntu server using my old DOS laptop.

I have been using a Tulip lt 286 and it comes with an external Floppy disk port, a VGA connector that can be used for an external VGA monitor, 1 external serial COM1 port, a 2400 baud modem on COM2, 1 PS/2 port for an external keyboard, 1 external printer LPT1 port, 1 internal ISA bus port used for the IDE hard disk and 3.5 inch floppy drive and an external ISA bus port originally intended for connection to an external box containing 2 ISA BUS connectors.
I could use the external ISA bus port for a network card but I do not have the ISA expansion cable needed for this.

Getting the Ubuntu server ready

As server I used a Ubuntu 18.04.2 LTS computer that has an external COM port. There are 2 ways to add a tty to it.

1: I added "console=ttyS0" to the file /etc/default/grub in the line that now says: GRUB_CMDLINE_LINUX_DEFAULT="quiet splash console=ttyS0" 
Save the file. You might need to have admin rights to do that, if so, open the file with "sudo".After saving the file type "sudo update-grub" in terminal to enable the new boot options. Reboot the server to apply the changes.

Or:

2: Apply a Systemd service using Execstart=/sbin/getty -L 38400 ttyS0 

Its that easy, nothing to install.

Getting the DOS computer ready.

Getting software on the old laptop is a pain because most of my floppy disks are 20+ years old and they keep failing.

I installed DOS 6.22 on the laptop and installed Norton Commander 5.5 to copy files between several computers with a (serial) nullmodem cable.

I also installed IBM-PC MS-DOS Kermit v3.16 Beta 7 patch level 0 and (eventually) found it very helpful. But if you use this program for the first time you can be a little lost as it has a steep learning curve. Here is some excellent reading material on DOS/Kermit http://kermitproject.org/onlinebooks/usingmsdoskermit2e.pdf .

With the nullmodem connected to my Ubuntu servers COM port I can now connect to an Ubuntu terminal session.
Connected to an Ubuntu terminal session via COM1
After startup of Kermit on the DOS computer type "set speed 38400" to set the speed of the serial connection. Then type "c" to open the terminal and connect to the Ubuntu server. Al other default settings of Kermit are fine.

The (modern) Ubuntu server has a far higher serial port speed compared to the DOS laptop so you will have to press the ENTER button a few times to make a successful connection. Some random characters may appear on your screen. The Ubuntu server will start with a baud rate of 115200 but will try lower speeds and eventually a connection at a lower baudrate will succeed.

The first time I logged in there was in intriguing message on the screen.
"You have new mail."
What to do? I never had this message when I logged into the server using the server itself. I never knew the server handled any mail.

I typed "mail" and saw a long list of mails the kernel send me about failures etc.
Then "r" to read, "d" to delete, "n" for next message, and so on.
It turned out I had more that 2600 mails waiting for me and the standard mail application wanted me to read them all one by one.

Therefore I installed Alpine by typing "sudo apt install alpine" into the terminal on the DOS computer. To handle the mail instead of typing "mail" I type "alpine". Without configuring anything alpine takes over and handles all mails and shows them to you in an ordered and easy text interface.

To get double the rows (lines) and columns add the following line in your autoexec.bat.

MODE CON: cols=80 lines=50

Now all seems well until Midnight commander, Alpine or any other Ubuntu terminal program is opened. Only the upper half of the screen is used. There is no way Ubuntu can find out the dimensions of your terminal so it assumes you have a VT102 terminal that like most terminal types has only 24 lines of text. Type "sudo resize" to maximise the screen space the program is using to all full 80 x 49 characters instead of only 80 x 24. (sudo apt install xterm may be needed)

I can log into my Ubuntu server from my DOS laptop which is great and completely useless.
Next thing to try is running a graphical browser on my DOS laptop. Arachne runs fine but I still need that DOS TCP/IP driver.  

How to Link DOS to Ubuntu in Norton Commander with a nullmodem cable

How to use "Link" in Norton Commander between an old DOS computer and an Ubuntu computer with Norton commander inside a DOSBox.

All was tested on DOS 6.22 with Norton Commander 5.5 running on one side and Ubuntu 18.04.2 LTS  with Norton Commander 5.5 running in a DOSBox 0.74 on the other side of a (serial) nullmodem cable.


  • Use a (serial) nullmodem cable on both COM1 ports.
  • Set the COM1 port on both computers to the same speed.(9600 is reliable on old computers) On ubuntu set the speed with "sudo stty -F /dev/ttyS0 9600". Check the speed with "stty -F /dev/ttyS0".
  • To check if the cable is going into the correct connector/port attach an old (Microsoft) serial mouse to the port, it will not work. Type in terminal "sudo inputattach --microsoft /dev/ttyS0". If you can move the pointer with the serial mouse the port is working correct and it is ttyS0. This is not a solution for a serial mouse but works fine for this test.
  • To be able to create directories in DOSBox on Ubuntu start DOSBox manually in a terminal with sudo.
  • Open DOSBox and configure "serial1=directserial realport:ttyS0". You can do this by typing " serial1 directserial realport:ttyS0" (This is confusing because you are using a cable called nullmodem and there is also the (wrong) option to go for "serial1=nullmodem")
  • Check the setting at the dosbox command prompt with "serial1"
  • Start Norton Commander 5.5 on both computers and open the menu with F9 and open the "Left" or "Right" panel, scroll down and open "Link".
Screenshot of Norton Commander 5.5 in DOSBox on Ubuntu 18.04.2 LTS

  • Choose Master on one side and Slave on the other side and press Link on both sides.
  • Now the master computer has a panel that has files on the other computer and files can be copied from one computer to the other and back.

Tuesday, May 14, 2019

Norton Commander "Link" between DOS and Win10 computer

This setup is used for transferring files between an old MS-DOS computer and a modern computer like Windows 10. Both sides are using Norton Commander only one of them is running in a DOSBox.
All was tested on DOS 6.22 with Norton Commander 5.5 running on one side and Windows 10 Pro 1809 with DOSBox 0.74-2 running on the other side of a (serial) nullmodem cable.

How to use "Link" in Norton Commander between an old DOS computer and a Windows 10 computer with Norton commander inside a DOSBox.

  • Use a (serial) nullmodem cable on both computer COM1 ports. DOSBox has not implemented the use of LPT ports. To test it with a parallel port you will need two real DOS computers.
  • Set the COM1 port on both computers to the same speed.(9600 is reliable on old computers)
  • Open DOSBox and configure "serial1=directserial realport:COM1". You can do this by typing " serial1 directserial realport:COM1" (This is confusing because you are using a cable called nullmodem and there is also the (wrong) option to go for "serial1=nullmodem")
  • Check the setting at the dosbox command prompt with "serial1"
  • Better to set this in the dosbox config file.
  • Restart dosbox and check in the dosbox terminal (The black second screen behind the DOSBox screen) if the COM port is used ok. If not, a connection in Windows might prevent DOSBox from taking the line.
  • Start Norton Commander 5.5 on both computers and open the menu with F9 and open the "Left" or "Right" panel, scroll down and open "Link".
Screenshot of Norton Commander 5.5 in DOSBox on Ubuntu 18.04.2 LTS
  • Choose Master on one side and Slave on the other side and press Link on both sides.
Now the master computer has a panel that has files on the other computer and files can be copied from one computer to the other and back.