The current code only forwards the printer definitions for printers marked as "LOCAL", maybe we want to allow more than that, see EnumPrinters.
Implemented in r11383:
XPRA_WIN32_PRINTER_FLAGS
can be used to select the flags we will query (see https://msdn.microsoft.com/en-us/library/windows/desktop/dd162692(v=vs.85).aspx for details on the possible values)
XPRA_WIN32_PRINTER_LEVEL
env var can be used to change the "printer-level" parameter (I don't think we want to change it, but it's there)
To see more debugging, run the Print.exe
tool with printing debugging turned on:
SET XPRA_PRINTING_DEBUG=1 Print.exe
Note: although the documentation seems to imply that flags values can be OR-ed together, in my testing this was not the case. So the code will just iterate over each flag and query each type individually.
ie querying both LOCAL
and SHARED
printers:
C:\Program Files\Xpra>SET XPRA_WIN32_PRINTER_FLAGS=LOCAL,SHARED C:\Program Files\Xpra>Print.exe PRINTER_ENUM_VALUES: {'REMOTE': 16, 'NAME': 8, 'CONNECTIONS': 4, 'SHARED': 32, 'LOCAL': 2, 'NETWORK': 64} PRINTER_FLAGS=SHARED, LOCAL PRINTER_ENUMS=['SHARED', 'LOCAL'] querying SHARED printers SHARED printers: [] querying LOCAL printers skipped printer: 8388608, Microsoft XPS Document Writer,Microsoft XPS Document Writer,, Microsoft XPS Document Writer, found printer: 8388608, Canon iP2700 series,Canon iP2700 series,hello, Canon iP2700 series, a1 LOCAL printers: ['Canon iP2700 series'] win32.get_printers()={'Canon iP2700 series': {'printer-info': 'Canon iP2700 series,hello', 'type': 'LOCAL', 'printer-make-and-model': 'a1'}} * Canon iP2700 series printer-info : Canon iP2700 series,hello type : LOCAL printer-make-and-model : a1
@afarr / llippold: do we want to change the default? how does that play with network printers? AD? Samba shared printers? Cups shared printers? More importantly: does this cause loops if the client can see the cups server where we forward the printer? etc..
Re-attempting with a Win8.1 64-bit machine with a 0.17.0 r11765 client:
Print.exe
finds 0 printers. Local or network shared
XPRA_PRINTING_DEBUG=1
has no effect on the output.
output:
C:\Program Files (x86)\Xpra>set XPRA_WIN32_PRINTER_FLAGS=LOCAL,SHARED C:\Program Files (x86)\Xpra>Print.exe 2016-01-28 14:02:59,510 PRINTER_ENUM_VALUES: {'REMOTE': 16, 'NAME': 8, 'CONNECTI ONS': 4, 'SHARED': 32, 'LOCAL': 2, 'NETWORK': 64} 2016-01-28 14:02:59,510 PRINTER_FLAGS=LOCAL, SHARED 2016-01-28 14:02:59,512 PRINTER_ENUMS=['LOCAL', 'SHARED'] get_printers() gsview is missing, not querying any printers get_mimetype()=['application/pdf', 'application/postscript'] System Configuration: mimetypes : application/pdf, application/postscri pt mimetypes.default : application/pdf, application/postscri pt
Your problem comes from:
get_printers() gsview is missing, not querying any printers
This was caused by r11583 (for #1041), and should be fixed in r11772. New beta build uploaded.
Upped to r11772:
C:\Program Files (x86)\Xpra>Print.exe 2016-01-28 15:40:40,249 PRINTER_ENUM_VALUES: {'REMOTE': 16, 'NAME': 8, 'CONNECTI ONS': 4, 'SHARED': 32, 'LOCAL': 2, 'NETWORK': 64} 2016-01-28 15:40:40,249 PRINTER_FLAGS=LOCAL, SHARED 2016-01-28 15:40:40,249 PRINTER_ENUMS=['LOCAL', 'SHARED'] init_printing(None) printers_modified_callback=None querying LOCAL printers LOCAL printers: [] querying SHARED printers SHARED printers: [] win32.get_printers()={} get_mimetype()=['application/pdf', 'application/postscript'] System Configuration: mimetypes : application/pdf, application/postscri pt mimetypes.default : application/pdf, application/postscri pt
Not sure what other logs to give you, I still have the debug enabled, along with the local and shared flags. The printer is added, and I can print to it from Notepad.
Have you tried tweaking the XPRA_WIN32_PRINTER_FLAGS
?
ie:
SET XPRA_WIN32_PRINTER_FLAGS=LOCAL,SHARED,REMOTE,NETWORK
Same result with XPRA_WIN32_PRINTER_FLAGS=LOCAL,SHARED,REMOTE,NETWORK
.
maxmylyn: please include the Print.exe -v
output for this case
Output as requested(with debug flag enabled):
C:\Program Files (x86)\Xpra>Print.exe -v 2016-01-28 15:57:45,318 PRINTER_ENUM_VALUES: {'REMOTE': 16, 'NAME': 8, 'CONNECTI ONS': 4, 'SHARED': 32, 'LOCAL': 2, 'NETWORK': 64} 2016-01-28 15:57:45,318 PRINTER_FLAGS=LOCAL, SHARED, REMOTE, NETWORK 2016-01-28 15:57:45,318 PRINTER_ENUMS=['LOCAL', 'SHARED', 'REMOTE', 'NETWORK'] init_printing(None) printers_modified_callback=None querying LOCAL printers LOCAL printers: [] querying SHARED printers SHARED printers: [] querying REMOTE printers REMOTE printers: [] querying NETWORK printers NETWORK printers: [] win32.get_printers()={} get_mimetype()=['application/pdf', 'application/postscript'] System Configuration: mimetypes : application/pdf, application/postscri pt mimetypes.default : application/pdf, application/postscri pt
Not sure it will help but it is worth a try, can you try with values 2, 4 and 5:
set XPRA_WIN32_PRINTER_LEVEL=2 Print.exe -v
Setting it to 2(and 4 and 5) added a new line to the print output:
Warning: failed to query REMOTE printers: (124, 'EnumPrinters', 'The system call level is not correct.')
Damn. The documentation is not very helpful: EnumPrinters.
I did find one similar query for pywin32: printer identification on Windows network - and it seems that in order to query network printers we may need to pass all 3 flags at once... so r11775 allows you to do just that:
set XPRA_WIN32_PRINTER_FLAGS=LOCAL,NETWORK+SHARED+CONNECTIONS Print.exe -v
You should first clear XPRA_WIN32_PRINTER_LEVEL (or reset to 1 which is the default), and maybe if you are desperate try different flag combinations and different printer levels.. (seems easier than understanding the API docs). I really hope this helps because my systems don't have such network printers available for testing, and I've wasted a lot of time on this already.
New beta posted.
upped the client to r11776:
XPRA_WIN32_PRINTER_FLAGS=LOCAL,NETWORK+SHARED+CONNECTIONS
now outputs the following (with only an AD printer installed):
C:\Program Files (x86)\Xpra>Print.exe * \\Spikes-dc3.Spikes.Inc\CM1415fnwOnQARack printer-info : \\Spikes-dc3.Spikes.Inc\CM1415fnwOnQA Rack,HP Color LaserJet A4/Letter PCL6 Class Driver type : NETWORK, SHARED, CONNECTIONS System Configuration: mimetypes : application/pdf, application/postscri pt mimetypes.default : application/pdf, application/postscri pt
Looks like that did it.
Added a Windows Shared Printer(same flags):
C:\Program Files (x86)\Xpra>Print.exe * \\DESKTOP-6OGV4KM\OfficePrinter (HP LaserJet CM1415fnw) printer-info : \\DESKTOP-6OGV4KM\OfficePrinter (HP L aserJet CM1415fnw),HP LaserJet Professional CM1410 Series PCL 6,End of testbench type : NETWORK, SHARED, CONNECTIONS printer-make-and-model : This is for testing, please do not us e. * \\Spikes-dc3.Spikes.Inc\CM1415fnwOnQARack printer-info : \\Spikes-dc3.Spikes.Inc\CM1415fnwOnQA Rack,HP Color LaserJet A4/Letter PCL6 Class Driver type : NETWORK, SHARED, CONNECTIONS System Configuration: mimetypes : application/pdf, application/postscri pt mimetypes.default : application/pdf, application/postscri pt
Again looks like that worked. After chatting with Jok, it sounds like setting up a printer in CUPS, then sharing it over the network will be quite time consuming for little results. In his words, anyone that bothers to do it that way will definitely know what they're doing. I'll leave it up to you if you want us to try setting it up. I'll also look into sharing a printer from OSX, but I have a distinct feeling that Apple will make that hard. In the meantime, it's detecting the printers without difficulty.
Review
@maxmylyn: cups should definitely be tested, as this is what we setup server side. We don't want to end up creating loops where a client then forwards a printer to the server, which adds it in cups, and gets picked up by the client again.. The machines will need to be on the same network with mdns enabled for the printers to be automatically added, Fedora does this by default I believe. Same for osx, which also uses cups. Until that is confirmed, I am reluctant to make it auto-add network printers.
That took the better part of today. (Somebody owes Jok and me several beers now)
From here:
Now that I'm connected, I can print to the printer in Windows - the one I added from the SMB Share. This works. Refreshing the SMB share shows no new printers. This is a relatively clean Fedora 23 machine, so it seems to work here.
Still TODO:
r11843 makes querying network printers the default in trunk.
r11844 backports both changes to v0.16.x
Please close if this works for you.
Ok... confirmed that maxmylyn set up the CUPS printer on a Fedora 23 machine as well as setting up the same printer as a local printer... then connected a windows client to the server which also had an AD network set up for the same printer, the same printer set up as a local printer on the windows client, and the same printer set up as a shared printer via yet another windows machine on the same network.
There were a lot of choices of icons to use in order to print to that printer (maybe the printer should be re-named to Rome)... but we didn't come up with any sane configuration that would produce any loops.
Closing - but will open a new ticket promptly if it turns out there's a configuration we missed which causes a problem.
Contrary to what comment:15 says, network printers were not enabled by default in 0.16.x (and no one told me), r12222 fixes that.
this ticket has been moved to: https://github.com/Xpra-org/xpra/issues/1048