Saltar para: Post [1], Comentários [2], Pesquisa e Arquivos [3]




First of all, sorry for posting this in english. Hopefully, I'll post this in portuguese too. I chose english as this might be interesting to a wide community of raspberry pi users out there.

 

So what's this all about? Really, it's about making good use of an extremely cheap, low powered computer that I got at Codebits last year. I actually replaced a $600 mac mini I had doing all these things before.

 

My goal was to have a reliable Media Center that could connect to a NAS device (I use Synology DS1511) and play all my videos, photos and MP3.

Also, at home we all have a computer and we all need to print or scan something every once in a while. I could have bought a network printer and scanner but instead I already owned an old Canon Inkjet printer, the PIXMA MP630 which has been doing it's job quite well for years. As it happens, this is a multifunction device and works as a scanner too. What follows is a recipe to have everything working.

 

You'll need a 4GB SD card and a Mac to start the procedure. Everything else is done on the Raspberry Pi.

You should have some knowledge of working "with black windows full of letters" as my daughter says.

 

1. Install raspbmc

 

Raspbmc is a debian wheezy distribution optimized for XBMC Media Center. There are some others but for some reason I like this one. Any other debian based should work though.

 

Open a terminal window on your mac, insert the SD card on a card reader and run these:


$ curl -O http://svn.stmlabs.com/svn/raspbmc/testing/installers/python/install.py
$ chmod +x install.py
$ sudo python install.py

 

Now follow the on screen instructions.

 

2. Boot raspbmc on your Raspberry Pi

 

Insert the card on the Raspberry pi. It will boot and complete the installation. Grab a coffee :)

Go ahead and play a bit with XBMC. It's great. And if you have one of those TVs that support CEC then you can even use your TV remote to navigate on XBMC. I know for a fact that Samsung and Sony TVs work quite well.

 

3. Log on to your Raspberry Pi

 

Open your terminal and run this:

 

$ ssh pi@192.168.1.169

 

it will prompt you for a password. Raspbmc uses the default password "raspberry". I advise you to change it just in case.
Take some time choosing your locale and time zone settings. It will only prompt you once for these.

 

4. Update your installation

 

The network installation of Raspbmc you just did will probably download all the latest packages. However, just to be sure, run these commands:


$ sudo apt-get update
$ sudo apt-get upgrade

 

5. Now it's time to setup the printer server.


$ sudo apt-get install cups

 

(Grab a coffee. This will take a while)

 

$ sudo usermod -a -G lpadmin pi

 

We're adding user "pi" to the lpadmin group. You'll need admin access to add printers. 

Now edit cupsd configuration:


$ sudo vi /etc/cups/cupsd.conf

 

And change Listem localhost:631 to Listen *:631.

Also change or add the following lines. Replace 192.168.1.* with the IP addresses of your network. My network is 192.168.1.0/24

 

Listen *:631

<Location />
Order allow,deny
Allow 192.168.1.*
</Location>

<Location /printers>
Order allow,deny
Allow 192.168.1.*
</Location>

# Restrict access to the admin pages...
<Location /admin>
Order allow,deny
Allow 192.168.1.*
</Location>

 

We're telling cups which IPs in the network have access to. If you trust your network and if you're sure there's no access from outside, you can skip editing the file and just enter:

 

$ sudo cupsctl --remote-admin 

$ sudo cupsctl --remote-any 

 

Now you have to restart CUPS

 

$ sudo /etc/init.d/cups restart

 

Please note the IP address of your Raspberry Pi. You'll need it later

 

$ ifconfig eth0  | grep "inet addr" | awk -F: '{print $2}' | awk '{print $1}'

 

6. Add your printer

 

On your mac, grab a browser and point it to your Raspberry Pi's IP on port 631. Mine is on 192.168.1.169, so...

 

https://192.168.1.169:631

 

Don't worry about the certificate warning. It's self signed so your browser will rightfully warn you about it.

 

Now click on Administration and then on Add Printer

You should be prompted with a user and password. Of course, use "pi" as the user and "raspberry" as the password (or whatever new password you chose)

You should see a list of local printers. Mine was listed as "Canon MP630 series (Canon MP630 series)"

Press continue, review the information and make sure you check "Share this printer"

 

Choose a make and model and finally add the printer.

 

7. Add your new network printer on OSX

 

This is where I've seen most people make a mistake so beware. When you add this printer under OSX, the default driver is postscript based. This means the Mac will send a postscript file back to the CUPS server. Now the server has to convert postscript to whatever the printer understands. This is bad. This conversion is both memory and cpu consuming. Printing a page would take up to 10 minutes if you use these settings.

What I did was: I installed the correct driver on OSX as if I had the printer connected locally and used that driver. This means that all processing is done by my computer and the Raspberry Pi only has to forward it to the printer.

 

In my case, I installed CanonPrinterDrivers from Apple and chose MP 630 Series driver on the printer add dialog.

 

Printing done! Go ahead and print a few documents. It's fast and has almost no impact on the Raspberry. I actually had a video playing without problems.

 

8. Now for the scanner.

 

While installing CUPS you also installed SANE. So everything should be in place.

To be sure, run this command:

 

$ scanimage -L
device `pixma:04A9172E_145C70' is a CANON Canon PIXMA MP630 multi-function peripheral

 

So, SANE identified my device correctly. Actually, if I try:

$ scanimage --format=tiff > ~/myimage.tiff 

It works.

 

But now we need to tell SANE who is allowed to scan from the network.

Grab your editor:

 

$ sudo vi /etc/sane.d/saned.conf

 

And simply add this line

 

192.168.1.0/24

 

Again, change it to match your network. This means that every IP from 192.168.1.1 to 192.168.1.255 will be able to use the scanner.

Now make sure SANE starts by default. You need to edit another file:

 

$ sudo vi /etc/default/saned

 

And change this line to yes

RUN=yes

 

9 Setup your scanner client under OSX

 

Now, unfortunatelly, Apple has been shooting itself in the foot as far as network scanning is concerned. With the latest versions (I tried 10.7 and 10.8) you can't make your scanner appear under "Image Capture". However, with a few tweaks you can make things work.

 

First, you need to install SANE Backends for OSX. There's a nice port here: http://www.ellert.se/twain-sane/

Install libusb and SANE Backends, SANE Preferences Pane in this order

 

Now you must tell your mac where to search for the scanner.

Edit this file:

 

$ vi /usr/local/etc/sane.d/net.conf

 

And add your Raspberry Pi's IP right at the end.

In my case, 192.168.1.169

 

Now go ahead and see if your mac recognizes the network scanner:

 

$ scanimage -L
device `net:192.168.1.169:pixma:04A9172E_145C70' is a CANON Canon PIXMA MP630 multi-function peripheral

 

There! If you're a command-line fan, you can simply use "scanimage"

If you prefer a gui to scanimage, download "snac" from here http://www.wallner.nu/fredrik/software/snac/

 

It's just a GUI frontend to scanimage but it allows you to scan and save the picture.

 

I hope this is useful to somebody.

Cheers.

Autoria e outros dados (tags, etc)



31 comentários

Sem imagem de perfil

De Kanad Kalasur a 06.02.2014 às 12:56

hi,
I'm really inspired by your article so if you don't mind I'm going to post a link to here in my post. I hope that is ok. I'm writing a series of articles on Raspberry Pi.

Comentar post



Sobre mim

foto do autor






Arquivo

  1. 2014
  2. J
  3. F
  4. M
  5. A
  6. M
  7. J
  8. J
  9. A
  10. S
  11. O
  12. N
  13. D
  14. 2013
  15. J
  16. F
  17. M
  18. A
  19. M
  20. J
  21. J
  22. A
  23. S
  24. O
  25. N
  26. D
  27. 2012
  28. J
  29. F
  30. M
  31. A
  32. M
  33. J
  34. J
  35. A
  36. S
  37. O
  38. N
  39. D
  40. 2011
  41. J
  42. F
  43. M
  44. A
  45. M
  46. J
  47. J
  48. A
  49. S
  50. O
  51. N
  52. D
  53. 2010
  54. J
  55. F
  56. M
  57. A
  58. M
  59. J
  60. J
  61. A
  62. S
  63. O
  64. N
  65. D
  66. 2009
  67. J
  68. F
  69. M
  70. A
  71. M
  72. J
  73. J
  74. A
  75. S
  76. O
  77. N
  78. D
  79. 2008
  80. J
  81. F
  82. M
  83. A
  84. M
  85. J
  86. J
  87. A
  88. S
  89. O
  90. N
  91. D
  92. 2007
  93. J
  94. F
  95. M
  96. A
  97. M
  98. J
  99. J
  100. A
  101. S
  102. O
  103. N
  104. D