GNOME Bugzilla – Bug 699942
The printer applet doesn't detect network printer
Last modified: 2014-03-28 10:19:46 UTC
My old HP Deskjet 815C is connected to my wifi router. From the gnome-control-center, this is no way to make my printer detected. I tried the IP address, the smb path, the name of the router, etc...nothing works. But it works using system-config-printer.
Forgot to say I run Ubuntu Gnome 13.04 + the Gnome 3 ppa, 64 bit.
Hi romu, the router probably advertises the printer through LPD or JetDirect protocol. Could you run nmap on IP address of your wifi router and tell me whether there is port 515 or 9100 active? Maybe the model name of the router could help me too. Regards Marek
Hi Marek, I run "nmap -n -sS <router ip>", and I can confirm there is no open port 515 nor 9100. My router is a Freebox, the box provided by Free, one of the main French ISP. Free maintains a bug tracker for its box, I can raise a bug report, but I would appreciate any help about the changes to request.
It uses SMB to advertise the printer: http://www.freenews.fr/spip.php?article9778
(In reply to comment #4) > It uses SMB to advertise the printer: > http://www.freenews.fr/spip.php?article9778 Thank you for the link. romu, could you try these commands and tell me whether they listed your printer?: smbtree -N smbclient -L address-of-the-router -N smbclient -L address-of-the-router --user=username-configured-on-the-page - this will ask you for the configured password Btw, does nmap shows opened port 445 on the server? And just to be complete, do you have the sharing turned on on the page? Regards Marek
smbtree -N -> OK \\FREEBOX Freebox Server \\FREEBOX\IPC$ IPC Service (Freebox Server) \\FREEBOX\Hewlett-Packard DeskJet 815C smbclient -L address-of-the-router -N -> OK Domain=[XXXXXXX] OS=[Unix] Server=[Samba 3.0.37] Sharename Type Comment --------- ---- ------- Hewlett-Packard DeskJet 815C Printer smbclient -L address-of-the-router --user=username-configured-on-the-page -> OK Domain=[XXXXXXX] OS=[Unix] Server=[Samba 3.0.37] Sharename Type Comment --------- ---- ------- Hewlett-Packard DeskJet 815C Printer Nmap 445/tcp open microsoft-ds Yes sharing is allowed as the router includes a hard drive I can access from family computers. So, as everything seems to work, I deleted the printer, and tried again, because I raised this bug a long time ago. Now the printer is detected, it is shown with the path //<domain>//FREEBOX. So this part is fixed. But when I try to select the right printer and driver, the final result is "Adding new printer failed".
Thank you for the info. Does gnome-control-center print a warning to console during the addition of the printer?
Hi Marek, I've tried with both drivers proposed: CUPS+Guntenprint and hpcups, same results. Here is the output: (gnome-control-center:4922): printers-cc-panel-WARNING **: cups-pk-helper: addition of printer Hewlett-Packard-DeskJet-815C failed: client-error-not-possible (gnome-control-center:4922): printers-cc-panel-WARNING **: Installation of the new printer failed. In both cases, I get this trace.
Hi, thank you for the info, it seems that the new printer dialog is passing a directory instead of a file to a request. Could you turn on debugging in CUPS and try to add the printer again and paste here the log (or send it to my email address if you don't want to publish it)? You can turn the debugging on by setting "LogLevel debug" in "/etc/cups/cupsd.conf" and restarting cups by "service cups restart". The log is located in "/var/log/cups/error_log". Don't forget to turn the debugging off again after that ("LogLevel warn" is default) since it generates quite a lot of messages. Regards Marek
Created attachment 272899 [details] Cups error log file
Find here the cups error file. Hope this helps.
Thank you for the log. I see the cause probably. The name of the printer contains spaces which the new printer dialog passes through the printer's URI to CUPS. But there are no spaces allowed. I'll try to find a solution for this.
Created attachment 273078 [details] [review] Don't fail when adding Samba printers with spaces Attached patch fixes the problem for me. It escapes URIs composed of names of the SMB servers and the SMB shares.
Review of attachment 273078 [details] [review]: ::: panels/printers/pp-samba.c @@ +411,3 @@ + uri = g_strdup_printf ("%s/%s", dirname, dirent->name); + device->device_uri = g_uri_escape_string (uri, Is the "/" in the device uri supposed to be escaped as well? I guess not. So better is to escape each component of your URI separately and then concatenate them.
(In reply to comment #14) > Review of attachment 273078 [details] [review]: > > ::: panels/printers/pp-samba.c > @@ +411,3 @@ > > + uri = g_strdup_printf ("%s/%s", dirname, dirent->name); > + device->device_uri = g_uri_escape_string (uri, > > Is the "/" in the device uri supposed to be escaped as well? I guess not. So > better is to escape each component of your URI separately and then concatenate > them. It is not supposed to be escaped and it is not escaped because it is included in the G_URI_RESERVED_CHARS_GENERIC_DELIMITERS. Escaping the strings separately would mean to free 2 new strings instead of 1.
(In reply to comment #15) > (In reply to comment #14) > > Review of attachment 273078 [details] [review] [details]: > > > > ::: panels/printers/pp-samba.c > > @@ +411,3 @@ > > > > + uri = g_strdup_printf ("%s/%s", dirname, dirent->name); > > + device->device_uri = g_uri_escape_string (uri, > > > > Is the "/" in the device uri supposed to be escaped as well? I guess not. So > > better is to escape each component of your URI separately and then concatenate > > them. > > It is not supposed to be escaped and it is not escaped because it is included > in the G_URI_RESERVED_CHARS_GENERIC_DELIMITERS. > Escaping the strings separately would mean to free 2 new strings instead of 1. What happens if there's a '/' in the printer name?
(In reply to comment #16) > What happens if there's a '/' in the printer name? It will not be escaped in that case. I'll test this tomorrow since I don't have any windows machine in office.
Creation of SMB share with '/' in its name is not allowed on my Windows XP machine so I tested this with ':' and it prints well in both cases.
Fine by me then.
Can I push it to 3.10, 3.12 and master?
Sure.
Comment on attachment 273078 [details] [review] Don't fail when adding Samba printers with spaces Thank you all for your help. I've pushed the patch to 3.10 and master/3.12 branches. Regards Marek
If someone has to thank someone else, it's me. So many thanks to Marek. Et merci à Bastien.