https://nelko.com/pages/driver-user-manual
Nelko PM220 (T45R) Linux Setup Guide: USB & Bluetooth
If you’ve struggled to get the Nelko PM220 (or similar T45R-chipset thermal printers) working on a modern Linux distro, this post is for you. We discovered that the “Golden Path” to a stable setup involves perfecting the USB connection first before moving to wireless.
1. The Mandatory First Step: USB Setup
Always get the printer working via USB before attempting Bluetooth. This ensures your driver and PPD are correctly configured without the added complexity of wireless permissions.
- The Driver: Use the official PL70e Linux driver package. The
rastertolabelbinary in this package is the most stable engine for the PM220. - The PPD: Modify your PPD to point to the
Nelko/Filter/rastertolabelfilter. - Key Settings:
- Ensure the
Resolutionline usescupsColorSpace 0(Grayscale) andcupsBitsPerColor 8. - Include
*cupsModelNumber: 20in the metadata. - If the printer works via USB but fails later on Bluetooth, you know the issue is a connection permission, not a driver fault.
- Ensure the
2. Connecting via Bluetooth SPP
Once USB printing is successful, you can move to wireless by mapping the Bluetooth signal to a legacy serial device node.
- Pairing: Use your system Bluetooth manager to pair with the PM220 (MAC:
31:9D:7B:7A:C1:9A). - The Serial Checkbox: Ensure “Serial Port” or “SPP” is enabled in your Bluetooth settings. This creates
/dev/rfcomm0. - User Groups: You must add your user to the
lpanddialoutgroups:
Bash
sudo usermod -a -G lp,dialout $USER
(Note: You must log out and back in for this to take effect.)
- The Persistence Rule: Create a
udevrule at/etc/udev/rules.d/99-pm220.rulesso thelpgroup always owns the port:
Plaintext
KERNEL=="rfcomm*", GROUP="lp", MODE="0660"
3. The “Silent Gatekeeper”: AppArmor
Even with the correct groups, modern Linux security (AppArmor) often blocks the CUPS service from writing to Bluetooth nodes, resulting in a “Permission Denied” error.
The Fix:
- Edit the local CUPS profile:Bash
sudo nano /etc/apparmor.d/local/usr.sbin.cupsd - Add this permission line inside the file:Plaintext
/dev/rfcomm[0-9]* rw, - Reload AppArmor:Bash
sudo systemctl reload apparmor
4. Configuring CUPS
Set your device URI to the serial node created by your Bluetooth manager.
- Printer URI:
serial:/dev/rfcomm0 - CLI Setup Command:
Bash
sudo lpadmin -p Nelko_PM220_BT -v serial:/dev/rfcomm0 -E -P /path/to/your_modified.ppd
5. Troubleshooting & Maintenance
- Testing the Pipe: Verify the Bluetooth link by bypassing CUPS and sending raw TSPL code:
Bash
echo -e "\x1b\x40\x0aSIZE 40 mm,30 mm\x0aPRINT 1\x0a" > /dev/rfcomm0
- Baud Rate: Ensure the virtual port is set to 115200 in
rawmode:
Bash
sudo stty -F /dev/rfcomm0 115200 raw -echo
Important: Paper Handling Behavior
The printer’s behavior when closing the lid depends entirely on the media used:
- With Labels: The printer feeds slightly to calibrate, detects the gap, and sucks the label back in to the correct start position.
- With POS (Continuous) Paper: Because there is no gap to detect, the printer feeds approximately 20cm of waste paper. This is a firmware-level self-test and cannot be overridden by the driver.