Raspberry Pi 5250 Terminal Emulator
The Raspberry Pi 3b kit, from various kit providers, costs around $50 including case, heat sinks and power supply. Add a 8GB microSDHC card for less than $10 and you’ve got the makings of an inexpensive (sub $60) 5250 terminal.
There are two basic methods we’ve used with good success to create a 5250 terminal from a Raspberry Pi. First, if you have an IBM-i with active SWMA and are running IBM-i 7.x, then the new IBM-i Access Client Solution for Linux is one option. Alternatively, if you’re wanting a simple user interface with less user options (ie 5250-only) then the open source TN5250j project is your other option. Both of these programs are 100% java-based and thus can run on any OS or device that supports java without having to be recompiled.
The first basic assumption for our initial Raspberry Pi 5250 project is that we do not want a full GUI with all the bloat-ware that comes with Raspbian OS (as of the date of this post the current version is Raspbian Jessie). Thus, we’re building this with Raspbian Jessie Lite and adding a basic GUI. The second assumption is that we only want 5250 functionality and none of the user data connectivity offered by the IBM Access Client Solutions application, thus we will use the TN5250J product for this post.
Here are the basic steps that I will outline in some detail in this article:
- Download software and prep the microSD card
- Install the Raspbian Jessie Lite OS
- Update and modify the Raspbian OS
- Copy 5250 program and modify files
- Modify the boot load sequence of OS to auto-launch 5250
Step1: Download the Raspbian Jessie Lite .img file zip archive and unzip. If you’re a Windows user you’ll need to install Win32DiskImager. Also, go ahead and download TN5250J from sourceforge. If you purchase a new microSCHC card it should already be formatted, if not format as FAT32.
Step 2: Use Win32DiskImager to burn the Raspian Jessie Lite .img file to the microSD card. My suggestion is that if you’re going to use this microSD as a template for creating more microSD cards for more terminals, use a 4GB microSD card as your template. That way the image you’ll create will be 4GB instead of 8, 16 or 32GB. Once Win32DiskImager finishes writing the .img to the microSD card, Windows will prompt you to Format the drive – CANCEL this prompt. Accept and Exit Win32DiskImager. Eject the microSD card.
Step 3: Time to hone your Linux chops or learn some new ones. Once you insert the microSD card into your pi and apply power, the OS should boot to a login prompt. UserID: pi and Password: raspberry.
sudo raspi-config ->(4)localization -> (I1)Locales->Change Locale; scroll down and un-select (using space bar) en_GB.UTF-8 (unless of course you live in Great Britain), scroll down further to en_US.UTF-8 (for those in the US), tab, OK, on the next screen arrow down to en_US.UTF-8 (or other selected locale), tab, OK (this will generate locale files); Next, set your timezone: (I2)timezone (in my case US->Central); localization -> (I3)keyboard (Generic US/104 or other depending on location), next; the system defaults to English(GB), so scroll down to Other, select appropriate option, in my case English (US), next, scroll to top of list, US (English) or other language as appropriate; OK. Next, you should change the default pi password for security; finish (should prompt to reboot); if not, type sudo reboot at the terminal prompt.
Now for installing a base GUI without all the stock bloat-ware:
To make the RaspPi automatically boot to the GUI, use sudo raspi-config to go to Boot Option menu ->(B1)Desktop/CLI -> (B4)Desktop Autologin; tab; OK; tab; Finish;
Step 4: Next, we’ll download tn5250j-0.7.6-full-bin.zip (or latest version) from SourceForge and unzip. Rename the unzipped folder to tn5250j for simplicity. Copy the folder to a USB stick. Insert the USB stick into the booted RaspberryPi. The GUI should automatically prompt to “Open with File Manager”. Use File Manager to drag the tn5250j folder to /home/pi/ folder.
To create shell script for running TN5250J program:
To enable TN5250J to auto-start when pi boots:
To add an icon to the Desktop for TN5250J, go to a terminal session:
At this point, if you reboot the RasPi the system should auto-login to the GUI and then launch the TN5250J program (if you elected for auto-launch option above). You can then set up a terminal session to your IBM-i system (yes, you can define multiple sessions), remap your keyboard (by default the enter key on the number pad isn’t mapped as Enter). You’re restricted to two key maps per function, so if you’re used to the right control key also being an Enter key, you’ll have to choose. If for some reason you should have an issue with the TN5250J application locking up on launch due to a possible error in session settings, just launch a terminal session, cd /home/pi/.tn5250j *important: put the period in front of tn5250j in this case, as it is a hidden directory that contains the configuration files*. Typing pwd will display your current directory. Use ls -l to display files in the directory. You can delete the sessions file using sudo rm sessions. TN5250J will recreate the sessions file when you launch TN5250J and re-add the sessions to the configuration screen. Always remember to click APPLY. Mark the first session you create as “default” and it will auto-launch that session every time the device boots. Also, to modify session or add sessions, you must right-click the mouse inside the session window and the edit options panel will pop up.
If you want the Display Power Management System (DPMS) to NOT auto-sleep the display, add the following line to the lightdm.conf file in /etc/lightdm folder:
Another “nice to have” feature would be to enable VNC via the raspi-config function so that you can provide remote support for the RasPi terminal. There is also a Citrix Receiver built for the Raspberry Pi as well as a Parallels 2X client, RDP client, and several browsers including Chrome and Firefox. Setup and installation of those are a subject for another post. You can also set the top Panel bar to AutoHide so that if you’re using the device without a mouse the panel bar doesn’t show at the top of the screen.
In case you are interested, my typical hardware configuration consists of a RaspberryPi 3b board ($34.99), an Enokay case ($5.99) which screws together and comes with the two heat sinks needed for the pi board, a NorthPada power supply with on/off switch for $8.99 and an 8GB SANDisk microSD card which in bulk costs around $5.50. Don’t forget HDMI to VGA or HDMI to DVI converter cable if your monitor doesn’t have an HDMI input port as the RasPi video output is a full size HDMI port.