Skip to main content

Configure Raspberry Pi for Sharing Printer Samsung Xpress M2026 using CUPS and SAMBA.

Configure Raspberry Pi for Sharing Printer Samsung Xpress M2026 using CUPS and SAMBA.

(Samsung Xpress M2026 is one of the cheap laser printers and laser cartridge are available for very reasonable prices.)

Colour Direct Xpress M2026W M2070W M2022W M2020 M2070 M2020 M2026 Compatible Toner Cartridges Replace Samsung MLT-D111S - 1 PACK (£7.99)

Pre-requisite

Raspberry Pi configured and SSH terminal enabled (to upload the files to Raspberry Pi).
Internet connection on Raspberry Pi.

Install and Setup CUPS

Open command terminal and install CUPS

> sudo apt-get install cups

Installer will ask your permission about the disk usage, type Y to allow disk usage.

Next Add pi user to the lpadmin group (so pi user can add printers and classes)

> sudo usermod -a -G lpadmin pi

Enable remote adminstation so CUPS web interface is accessible of network:

> sudo cupsctl --remote-admin --remote-any --share-printer

Setup for Samsung Xpress M2020

As drivers shipped with CUPS are not compatible with Samsung Xpress M2026, you need to download them (here) and copy the following compiled filter files for Raspbian ARM architecture: (If you are using other platform build see instruction to compile filters down in the blog.)

rastertoqpdl
pstoqpdl

Copy above files for Samsung printer to directory /usr/lib/cups/filter/  and give them execute permission.


Note: You can use Filezilla to transfer files to your Raspberry Pi if using windows, first transfer them to "pi" user home directory and then using SSH terminal copy them to /usr/lib/cups/filter/ directory (as example >sudo cp ~/rastertoqpdl /usr/lib/cups/filter/ and add execute permission >sudo chmod +x /usr/lib/cups/filter/rastertoqpdl )

The splix_ppd_m2020.ppd file in zip package will be used later on the CUPS Web Interface.

Now we can configure the Samsung Printer Xpress through CUPS Web Interface. As my Raspberry Pi is running on IP address 192.168.1.103, I can access the admin page on https://192.168.1.103:631/ (It's better to use RaspberryPi hostname as IP can change based on your router setting)


click on "Administration" and then choose "Add Printer", when asked for authentication details enter your username "pi" and it's password (default is "raspberry")


The printer name should be shown in Local Printer list as "Samsung_M2020_Series" select it and press "Continue" button.

Then on next screen make sure "Share This Printer" is checked, you can leave the rest as default suggestions, and press "Continue".

On Make and Model screen, use "Choose File" button and select the downloaded file "splix_ppd_m2020.ppd" from your PC, and click "Add Printer".

Test Printer by first selecting "Printers" from the top menu:


Then click on the newly added printer link from the list and you should be displayed following screen, select "Print Test Page" from the drop-down:


If your printer is configured correctly your printer should print the CUPS test page. Make sure printer is not paused (you should not be able to see "Resume Printer" option in "Maintenance" drop-down, If you do select that option so printer can resume.)

Install and Setup Samba (for sharing printer to windows client)

The IPP (Internet Printing Protocol) was not working for me using windows 7 clients, while IPP was working from Android phones and I was able to print from my Huwaei and Samsung phones as they were able to detect the printer automatically on network, but not Windows 7 Hence need to configure Samba.

> sudo apt-get install samba

Once samba is installed use following command to configure printer sharing;

> sudo nano /etc/samba/smb.conf



change the read only = no and  guest ok = yes for [printers] and [print$] sections.
Save the file by pressing Ctrl+X and then pressing Y and then Enter.

restart the Samba service to pick configuration changes.

> sudo /etc/init.d/smbd restart

Configure Printer on Windows 7

In control panel > Devices and Printers choose option to "Add a Printer"


Then choose option for network printer


Then click on the link below "The printer that I want Isn't listed"


Then select "Select a share printer by name" and click "Browse ..." and enter your Raspberry Pi machine IP or hostname starting with \\ and your shared printers will be listed.


Double click on printer name and "Next" windows will ask your to select the drivers. Very important: choose "Generic" from Manufacturer and "MS Publisher Color Printer" from Printers list, and click "Next" and then "Finish".

You should be able to test print a document from your windows 7 desktop.


Optional: Compiling Samsung Filters (If you like to build filter by yourself) 

Install libscup2-dev for development tools

> sudo apt-get install libcups2-dev

Download & Extract splix to target machine from https://gitlab.com/ScumCoder/splix/tree/patches/splix/

Goto splix downloaded folder on target machine, for example:

> cd ~/Downlaods/splix

Compile Splix with uneccessary algorithm disabled

> sudo make DISABLE_JBIG=1

Run install script, which will place all needed binaries into cups/filter

> sudo make install


Troubleshooting

I had to remove CUPS and re-install it when I used the PPD file from Samsung drivers page, as CUPS was not replacing it with new version I was trying to upload the correct PPD file that I downloaded from splix website, there was no error on CUPS web interface but error/warning was logged in error logs:

 CreateProfile failed: org.freedesktop.ColorManager.AlreadyExists:profile id \'Samsung_M2020_Series-Gray..\' already exists

When Compiled filter was missing from splix following error was reported:

Samsung_M2020_Series: File \"/usr/lib/cups/filter/rastertoqpdl\" not available: No such file or directory

The errors can we viewed from CUPS admin page, the button having link is under Server section https://raspberrypi:631/admin/log/error_log 



Comments

Popular posts from this blog

Solving Raspberry Pi 4 Overheating Issues - RetroPie

I have setup the RetroPie on my Raspberry Pi 4 and while playing games for few minutes or so, I was getting RED temperature icon  blinking on right top side of screen, which was indication that my Pi 4 is running hot and system performance is being throttled.   I started reading article on websites and mostly suggesting to install heatsink but recommending to install the fan.  I thought let me try to install the heatsink first and see how my Pi 4 performs and if heatsink is not keeping it cool I will install the fan, I want to keep power usage minimum and was not huge fan of installing a fan.  I was not willing to spend money on buying the heatsink because I started Pi 4 for DIY projects and to save money :), so I started to search my old computer parts box for any spare heatsink and luckily I found an old heatsink hiding in the box. Now I need to install it on Pi 4 processor, as I didn't had any spare thermal glue and on internet they were not cheap e...