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 Ethan a 08.01.2014 às 14:11

Hi Eduardo,

If I 'scanimage -L' on Pi, it could detect my scanner.

device `pixma:04A91734' is a CANON Canon PIXMA MP190 multi-function peripheral

Sem imagem de perfil

De kriza a 20.01.2014 às 20:42

same problem here.

scanimage -L on RPI identifies scanner
scanimage -L on Mac "no devices found"

everything is configured regarding your post ... libusb, sane backend, sane preferences pane installed, IP address of my rpi is in net.conf

thanks for help.
Imagem de perfil

De Eduardo a 20.01.2014 às 22:09

I just followed every instruction on my post once again.
Here's my current setup:

iMac running 10.9.1
Raspberry Pi running Raspbmc
Canon Printer PIXMA MP630 connected via USB to the Raspberry Pi

I ran everything from start including cups setup and...

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

A couple more suggestions:

I'm posting my conf files on the link below. They represent the full path on the mac and on the raspberry pi.
https://meocloud.pt/link/517ab169-45d7-414a-978d-dc6e0acd0464/rpi-scanner/

Also, take a look at this link and make sure your scanner model is listed.
http://www.sane-project.org/sane-mfgs.html#SCANNERS

Finally, try this:
On the Raspberry Pi:
$ lsusb

Look for the device ID for your scanner. It's made up of two identifiers separated by ":" and look under /etc/saned.d/* on the Raspberry PI searching for the vendorID and productID on your scanner's brand file

If it's not there you may try to add it yourself but there's no guarantee that it will work. It should identify it at least.

Another tool you may try to run while debugging on the Raspberry Pi is
$ sane-find-scanner

Other than this I really don't know how I can help you more. Sorry
Sem imagem de perfil

De kriza a 21.01.2014 às 14:38

hello, thanks for your help.
unfortunately i have my HP listed under supported devices
http://www.sane-project.org/cgi-bin/driver.pl?manu=Hewlett+Packard&model=&bus=any

and i do not have problem on my RPi - there is scanner and i can scan via cmd line just fine, it's just Mac problem that from there it showing no scanners whatsoever.
So maybe my Mac cant find remote scanner or just is not properly communicating with rpi, but i dont have clue why.


maybe: when i change anything in any conf file, do i have to restart some services?

Thanks
Sem imagem de perfil

De kriza a 21.01.2014 às 16:47

pi@raspbmc:~$ scanimage -L
device `hpaio:/usb/PSC_2350_series?serial=MY4AUF40GTKJ' is a Hewlett-Packard PSC_2350_series all-in-one


MacBookPro:~ kriza$ scanimage -L

No scanners were identified. If you were expecting something different,
check that the scanner is plugged in, turned on and detected by the
sane-find-scanner tool (if appropriate). Please read the documentation
which came with this software (README, FAQ, manpages).


i do have IP of my rpi added to /usr/local/sane.d/net.conf
:(
Sem imagem de perfil

De Ethan a 30.01.2014 às 14:59

Hi Eduardo & Kriza,

Sorry that I was away from this. Actually what happend to me was that I put RUN=YES (YES in caps) instead of RUN=yes. After I changed it, my mac could detect the scanner over the IP.

Hope this helps.

With regards,
Ethan
Sem imagem de perfil

De kriza a 28.05.2014 às 16:27

hi there,
so little update (but i cant still get it work right).

my problem is (was) that saned was not running even /etc/init.d/saned start isnt working
so i googled a little and found xinetd.d approach when you add saned-daemon file into /etc/xinetd.d with this content

service sane-port
{
socket_type = stream
server = /usr/sbin/saned
protocol = tcp
user = saned
group = saned
wait = no
disable = no
}

this one is able to start saned for me.... but :)
by xinetd.d it starts as two proceses
saned 2014 0.0 0.1 2892 572 ? Ss 15:23 0:00 /usr/sbin/saned -a saned
saned 2015 0.2 0.2 2892 836 ? S 15:23 0:00 /usr/sbin/saned -a saned

which i figured out is problem when i run saned debuger

pi@raspbmc:~$ saned -d128
[saned] main: starting debug mode (level 128)
[saned] read_config: searching for config file
[saned] read_config: done reading config
[saned] saned (AF-indep+IPv6) from sane-backends 1.0.22 starting up
[saned] do_bindings: trying to get port for service "sane-port" (getaddrinfo)
[saned] do_bindings: [1] socket () using IPv6
[saned] do_bindings: [1] setsockopt ()
[saned] do_bindings: [1] bind () to port 6566
[saned] do_bindings: [1] bind failed: Address already in use
[saned] do_bindings: [0] socket () using IPv4
[saned] do_bindings: [0] setsockopt ()
[saned] do_bindings: [0] bind () to port 6566
[saned] do_bindings: [0] bind failed: Address already in use
[saned] do_bindings: couldn't bind an address. Exiting.
[saned] FATAL ERROR; bailing out, waiting for children...
[saned] bail_out: all children exited

in this case my mac is unable to reach saned so it calls "no scanners...."

but if i shut down two processes saned and run saned debuger again:

pi@raspbmc:~$ saned -d128
[saned] main: starting debug mode (level 128)
[saned] read_config: searching for config file
[saned] read_config: done reading config
[saned] saned (AF-indep+IPv6) from sane-backends 1.0.22 starting up
[saned] do_bindings: trying to get port for service "sane-port" (getaddrinfo)
[saned] do_bindings: [1] socket () using IPv6
[saned] do_bindings: [1] setsockopt ()
[saned] do_bindings: [1] bind () to port 6566
[saned] do_bindings: [1] listen ()
[saned] do_bindings: [0] socket () using IPv4
[saned] do_bindings: [0] setsockopt ()
[saned] do_bindings: [0] bind () to port 6566
[saned] do_bindings: [0] bind failed: Address already in use
[saned] run_standalone: spawning Avahi process
[saned] run_standalone: waiting for control connection
[saned] saned_avahi_callback: AVAHI_CLIENT_S_RUNNING
[saned] saned_create_avahi_services: adding service 'saned'
[saned] saned_avahi_group_callback: service 'saned' successfully established

and if i now run scanimage on mac, everything is ok and working.

so my problem is for sure at raspbmc side or bad saned daemon which runs two processes which makes problem with address binding.

but from here i dont know what to do :(

any help appreciated!

---
i had RUN=yes but process wont start anyway
Sem imagem de perfil

De kriza a 29.05.2014 às 12:04

hello,
little update if i hit /etc/init.d/saned start with sudo its working, otherwise its not and sane is not running

so i have to figure out where is problem in permissions during boot sequence ...
Sem imagem de perfil

De kriza a 29.05.2014 às 18:53

but besides that, if sane is running (two processes) i still cant scan from mac. so problem is still here :)

Comentar post








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