Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Printer channel driver name "hardwired" #3007

Closed
szolnoki opened this issue Dec 9, 2015 · 13 comments
Closed

Printer channel driver name "hardwired" #3007

szolnoki opened this issue Dec 9, 2015 · 13 comments

Comments

@szolnoki
Copy link

szolnoki commented Dec 9, 2015

I tested "This is FreeRDP version 2.0.0-dev (git n/a)" version.

I started freerdp with option:
/a:printer,HP4650_PCL,"HP Universal Printing PCL 6"

But HP_4650_PCL always use "Microsoft Publisher Imagesetter" driver on remote Windows.
("HP Universal Printing PCL 6" installed on remote Windows.)

My hotfix:
I changed "printer_cups.c"...
From:
cups_printer->printer.driver = "MS Publisher Imagesetter";
To:
cups_printer->printer.driver = "HP Universal Printing PCL 6";

And now, HP_4650 works at remote Windows with the "HP Universal Printing PCL 6" driver! :):):)
My solution works, but not nice... Why not use the specified driver name in command line, instead of default "Imagesettler"...

Why printer drive name "hardwired", when I set this option in command-line?
This problem is independent from printer type.

I would be better, if freerdp use the given driver name if specified instead of "Imagesettler".

@bmiklautz
Copy link
Member

@szolnoki did you try with the /printer command line already?

/printer:<device>,<driver>

I'm not sure that that the "addin syntax" (using /a) parses additional parameters if an extra parameter (like /printer) exists.

@szolnoki
Copy link
Author

I have tested. But not working. Absolutely same effect as "/a:printer". :(
Driver name only changed, when I modify the source code...
I think not possible to change driver name any other way. Because I searched "printer.driver" string in all source codes. "printer.driver" variable is set only one place, see the "hardwired" line above.

@bmiklautz bmiklautz added this to the 2.0 milestone Dec 10, 2015
@szolnoki
Copy link
Author

I continue to investigate this problem, and I found this.
Compiled with cmake options:
-DWITH_CUPS=ON -DCHANNEL_PRINTER=ON

Version: 2.0.0-dev (git df81e84)

Started the xfreerdp with option again and again:
/printer:HP4650_PCL,"HP Universal Printing PCL 6"

In remote Windows Devices&Printer settings, I see:

  1. The HP4650_PCL appear with driver "HP Universal Printing PCL 6"
  2. Some seconds later HP4650_PCL above disappear
  3. Some seconds later HP4650_PCL appear again, but with "MS Publisher Imagesetter" driver.
    :(:(:(:(

I added some extra logging "printf" to freeRDP printer channel driver, and I found the problem:

  1. I see in log: "[INFO][com.freerdp.channels.rdpdr.client] - Loading device service printer (static)"
  2. Calls GetPrinter for "HP4650_PCL"
  3. Calls printer_cups_new_printer for "HP4650_PCL"
  4. I see in log again: "[INFO][com.freerdp.channels.rdpdr.client] - Loading device service printer (static)"
  5. Calls EnumPrinters
  6. Calls printer_cups_new_printer for "HP4650_PCL"
  7. Calls printer_cups_new_printer for other printers...

I think, freeRDP calls the printer registration twice. First within driver->GetPrinter, when I specify a driver with "/printer" option. And again when try to enumerate all printers (driver->EnumPrinters). This last enumartion is destroys the initilaized printers and driver names, and use the default "MS Imagesettler" driver_name.

I made a quick test (and a fix for Me):
I commented out the total "if (name && name[0])" "else" code block in "DeviceServiceEntry" function.
With this change, I knocked out the whole enumaration process. But HP4650_PCL appear only in remote Windows when I specified "/printer:HP4650_PCL,...", but use the given driver. And printer appear only once, not twice

I think, freeRDP printer handling is broken, because always enumerate (and "overwrite") all printers, regardess given as "/printer:name,driver" option.

@szolnoki
Copy link
Author

I dig a little deeper:
I start freeRDP only with this "device":
/printer:HP4650_PCL,xxxx

But in rdpr_process_connect, settings->DeviceCount is 2 !
DeviceArray[0]: Id=0, Type=4, Name="HP4650_PCL"
DeviceArray[1]: Id=0, Type=4, Name=NULL

The DeviceArray[1] is fire the 2nd printer_DeviceServiceEntry, wich calls the EnumPrinters later, and re-install all printers with defult "MS Imagsettler" driver.

@trentasis
Copy link

any news about this issue, it seems that this issue persist with imagesetter...
thanks

@trentasis
Copy link

Hi @bmiklautz ,

Tried with /printer:, and not working, always appears iamgesetter, also tried with 'driver'

Waht can I do?

thanks

@hardening
Copy link
Contributor

@trentasis I confirm that the driver name is ignored and hardwired. I gave a look at the printer channel and it would need some love to fix that. I'll treat this when I'll have some time.

@fedsed
Copy link

fedsed commented Feb 26, 2016

Tell when to expect patches? Really need this feature.

@akallabeth
Copy link
Member

Does my pull work for you?

@fedsed
Copy link

fedsed commented Feb 29, 2016

System: Ubuntu 14.04 Linux lxhost38 3.13.0-77-generic #121-Ubuntu SMP Wed Jan 20 10:50:59 UTC 2016 i686 i686 i686 GNU/Linux

Download last github master.zip.

Compile switch:
cmake -DWITH_WAYLAND=OFF -DCMAKE_INSTALL_PREFIX=/opt/freerdp2 -DWITH_CUPS=ON -DWITH_CHANNELS=ON -DSTATIC_CHANNELS=ON -DCHANNEL_URBDRC=ON -DCHANNEL_URBDRC_CLIENT=ON -DWITH_GSTREAMER_1_0=OFF .

Run command:
/opt/freerdp2/bin/xfreerdp +clipboard /sec:rdp /v:ferma.domain.local /printer:HP-LaserJet-4050,"HP LaserJet 4050 PCL 6

[13:18:19:503] [32323:32324] [INFO][com.freerdp.client.common.cmdline] - loading channel rdpdr
[13:18:19:503] [32323:32324] [INFO][com.freerdp.client.common.cmdline] - loading channel rdpsnd
[13:18:19:503] [32323:32324] [INFO][com.freerdp.client.common.cmdline] - loading channel cliprdr

Segfault

Syslog:
Feb 29 13:03:05 localhost whoopsie[968]: Parsing /var/crash/_opt_freerdp2_bin_xfreerdp.65542.crash.
Feb 29 13:03:05 localhost whoopsie[968]: Uploading /var/crash/_opt_freerdp2_bin_xfreerdp.65542.crash.
Feb 29 13:03:10 localhost whoopsie[968]: Sent; server replied with: No error
Feb 29 13:03:10 localhost whoopsie[968]: Response code: 200
Feb 29 13:03:10 localhost whoopsie[968]: Got command: OOPSID
Feb 29 13:03:19 localhost whoopsie[968]: Parsing /var/crash/_opt_freerdp2_bin_xfreerdp.65542.crash.
Feb 29 13:03:19 localhost whoopsie[968]: Uploading /var/crash/_opt_freerdp2_bin_xfreerdp.65542.crash.
Feb 29 13:03:22 localhost whoopsie[968]: Sent; server replied with: No error
Feb 29 13:03:22 localhost whoopsie[968]: Response code: 200
Feb 29 13:03:22 localhost whoopsie[968]: Got command: OOPSID

I can provide file crash.

@akallabeth
Copy link
Member

@fedsed Please test with pull #3171 merged, there is a known regression introduced with #3156 or wait until it has been reviewed and merged to master.

@fedsed
Copy link

fedsed commented Feb 29, 2016

Include #3171.

Run command:
/opt/freerdp2/bin/xfreerdp +clipboard /sec:rdp /v:ferma.domain.local /printer:HP-LaserJet-4050,"HP LaserJet 4050 Series PCL6"

Printer redirected with the right drivers. Print test page OK.

Thank you for your work!

@akallabeth
Copy link
Member

@fedsed Good to know it works now :)
closing as resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants