Summary: | Tray selection (MediaSource) on PCL 4/5 drivers does not work and so an ugly Perl workaround in Foomatic is needed | ||
---|---|---|---|
Product: | Ghostscript | Reporter: | Till Kamppeter <till.kamppeter> |
Component: | Printer Driver | Assignee: | Ray Johnston <ray.johnston> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | jason, sphinx.pinastri |
Priority: | P4 | ||
Version: | 8.63 | ||
Hardware: | All | ||
OS: | All | ||
Customer: | Word Size: | --- | |
Attachments: |
pcl-input-slot-fix.patch
pclMediaPosition.patch |
Description
Till Kamppeter
2008-11-25 01:44:21 UTC
Created attachment 4622 [details]
pcl-input-slot-fix.patch
Patch to allow paper tray selection via "-dMediaPosition=..." in PCL 4/5
drivers
I also did not find any documentation for these drivers, so there cannot be broken any documented behavior. Patch committed to the Subversion Repository as revision 9241. Needs review whether it does not have any unwished side effects. Henrys recommended for getting this checked by Ray. Thanks for the patch! Quick suggestion - I found this bug here after finding it and fixing it in the code. (How sad I was that the order wasn't the other way around) - I believe we could make this a little better by requiring it to be a valid PCL5/6 tray option, and it's pretty straightforward. In hpjet_make_init we just set up an array full of the options, then loop through and only set it if our value passed in is a match, otherwise - don't put the parameter in the output file. I'll edit the patch, but I'm pasting this here as well first. ------ static void hpjet_make_init(gx_device_printer *pdev, char *buf, const char *str) { gx_device_hpjet *dev = (gx_device_hpjet *)pdev; int paper_source = -1; /* valid PCL5/6 Trays */ int paper_valid_trays[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39 }; if (dev->ManualFeed_set && dev->ManualFeed) paper_source = 2; else if (dev->MediaPosition_set && dev->MediaPosition >= 0 ){ int i; for (i = 0; i < countof(paper_valid_trays); i++){ if (dev->MediaPosition == paper_valid_trays[i]){ paper_source = dev->MediaPosition; break; } } } if (paper_source >= 0).... shoot. I've not created a patch via SVN before - I'll try to get it in here soon. Created attachment 4771 [details]
pclMediaPosition.patch
forcing valid tray selection...
Patch attached. jason r. totten, thank you for your suggestion, but I would rather not force the tray values, as there can be non-HP printers which use PCL and they do not have necessarily the same scheme of tray numbers. Controlling the selection by only offering the correct ones for the printer currently in use, for example via a PPD file is the better alternative in my opinion. Closing the bug again ... (In reply to comment #1) > Created an attachment (id=4622) [details] > pcl-input-slot-fix.patch While working on bug 692914 (which does MediaSource/MediaType for the pxl driver, rather than pcl5), I looked at related code elsewhere and realize this patch introduced a bug - the ... param_write_int(plist, "MediaPosition", &dev->MediaPosition); ... chunk (copying media position from the driver back to the language core) should not be there, as it is clearly stated in the documentation that this information should only go one-way, from the language core to the driver; if that code is included, the code should be conditional on it being set previously, i.e. ... if (dev->MediaPosition_set) code = param_write_int(plist, "MediaPosition", &dev->MediaPosition); ... otherwise there is a danger of copying an unintialized value of bogus MediaPosition (=0, mostly) where none had ever been specified, into the language core and that bogus value gets copied back in the next invocation of param_read() . Valgrind finds no uninitialized variables in valgrind ~/ghostpdl/debugbin/gs -sDEVICE=ljet4 -o /dev/null -c currentpagedevice setpagedevice What's wrong with 0 as an initial value for /MediaPosition ? This has been idle for 9 years. If there is a genuine bug (comment #11) please open a new bug report for it. |