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.


31 comentários

Sem imagem de perfil

De Ayi a 23.02.2013 às 17:04

Thank a lot for the tutorial !!

Comentar post



Sobre mim

foto do autor




Redes

Mastodon


Arquivo

  1. 2023
  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. 2022
  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. 2021
  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. 2020
  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. 2019
  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. 2018
  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. 2017
  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. 2016
  93. J
  94. F
  95. M
  96. A
  97. M
  98. J
  99. J
  100. A
  101. S
  102. O
  103. N
  104. D
  105. 2015
  106. J
  107. F
  108. M
  109. A
  110. M
  111. J
  112. J
  113. A
  114. S
  115. O
  116. N
  117. D
  118. 2014
  119. J
  120. F
  121. M
  122. A
  123. M
  124. J
  125. J
  126. A
  127. S
  128. O
  129. N
  130. D
  131. 2013
  132. J
  133. F
  134. M
  135. A
  136. M
  137. J
  138. J
  139. A
  140. S
  141. O
  142. N
  143. D
  144. 2012
  145. J
  146. F
  147. M
  148. A
  149. M
  150. J
  151. J
  152. A
  153. S
  154. O
  155. N
  156. D
  157. 2011
  158. J
  159. F
  160. M
  161. A
  162. M
  163. J
  164. J
  165. A
  166. S
  167. O
  168. N
  169. D
  170. 2010
  171. J
  172. F
  173. M
  174. A
  175. M
  176. J
  177. J
  178. A
  179. S
  180. O
  181. N
  182. D
  183. 2009
  184. J
  185. F
  186. M
  187. A
  188. M
  189. J
  190. J
  191. A
  192. S
  193. O
  194. N
  195. D
  196. 2008
  197. J
  198. F
  199. M
  200. A
  201. M
  202. J
  203. J
  204. A
  205. S
  206. O
  207. N
  208. D
  209. 2007
  210. J
  211. F
  212. M
  213. A
  214. M
  215. J
  216. J
  217. A
  218. S
  219. O
  220. N
  221. D