Opened 14 years ago

Last modified 4 years ago

#5994 in-progress bug

Printer is not added for BeOS R5 driver.

Reported by: dru_ed Owned by: ithamar
Priority: normal Milestone: R1
Component: Printing Version: R1/alpha2
Keywords: R5, HP PCL3, LaserJet, driver Cc:
Blocked By: Blocking:
Platform: x86

Description

Steps to reproduce: Obtain "HP PCL3 LaserJet Compatible" driver from R5

  1. In Haiku "Printers" preflet click "Add"
  2. Enter a "Printer name"
  3. Pick "HP PCL3 LaserJet Compatible" from "Printer type" menu
  4. Select "USB" or "Print to File" from "Connected to" menu
  5. Click "Add" button

Result: The "Add printer" dialog will close but no printer is added.

You can see an attempt is made because a new icon appears very briefly in /boot/home/config/settings/printers

Attachments (1)

add_printer.asm (6.0 KB ) - added by laplace 14 years ago.
Disassembly of the R5 add_printer function.

Download all attachments as: .zip

Change History (13)

comment:1 by laplace, 14 years ago

Status: newin-progress

comment:2 by laplace, 14 years ago

I am right now figuring out what's the problem (my first guess is that broken binary compatibility is the culprit).

Out of curiosity, why do you want to use the driver from BeOS R5. Isn't the Haiku PCL5 driver at least on par?

comment:3 by laplace, 14 years ago

Owner: changed from laplace to ithamar
Status: in-progressassigned

When the printer spooler folder is created the print_server is able to load the BeOS R5 printer driver add-on and then calls the function add_printer(spool_folder_name). In error case the function should return NULL, and this is what happens no in Haiku. I have now idea why.

BTW if the print_server ignores that error and creates the printer anyway. It seems that it can be used. I could print from StyledEdit to a file without any issues.

I am quite sure that the problem is not caused by bugs in the print_server or Printers preflet, because I have tested it on BeOS R5 with the Haiku print_server and preflet and it was not a problem to create a printer. The tested version is older than what's in Haiku, but the relevant parts for this have not changed, as far as I can tell.

For now I won't investigate any further. Someone with the proper disassembly experience could try to debug the function add_printer of the "HP PCL3 LaserJet Compatible" and see what causes the trouble.

Ithamar, I have assigned the ticket to you. Feel free to reassign it to me, if you don't want to look into it.

by laplace, 14 years ago

Attachment: add_printer.asm added

Disassembly of the R5 add_printer function.

comment:4 by ithamar, 14 years ago

Status: assignedin-progress

Found the problem! The add-on does a find_directory call with B_COMMON_SETTINGS_DIRECTORY as the parameter to find the settings directory with....

In BeOS, the COMMON dirs were the same as the USER ones, but in Haiku they aren't. Therefore, the add-on can't find the printer's directory, and returns NULL as a result.

Not sure how to fix this one though (besides patching the binary to use B_USER_SETTINGS_DIRECTORY :P)

comment:5 by laplace, 14 years ago

It actually makes more sense to store the installed printers in the common settings folder. In a multi-user environment you probably want the printers to be shared by all users and not to be user specific.

Therefore I propose to move the printers folder from user settings to common settings folder and update the print_server, preflet and Haiku printer add-ons to search in the common settings folder only. If it turns out that 3rd party printer drivers search in the user settings folder, we could create a symbolic link in the user settings folder to the printers folder in the common settings folder for backwards compatibility.

BTW a workaround for this ticket is also to create a symbol link to the printers folder in the common settings folder.
In Terminal type:

cd /boot/common/settings
ln -s /boot/home/config/settings/printers printers

comment:6 by dru_ed, 14 years ago

The workaround allows me to create the printer however it is not functioning correctly.

If the R5 PCL3 driver printer is set to USB port, printing form StyledEdit sends created a "Print job" but it spends its time "processing" endlessly. If the R5 PCL3 driver printer is to "Print To File" a file is created quickly. However the output is wrong.

To test the "Print To File," I compared a known good PCL3 file and the "Printed To File" by cp'ing to the device in Terminal:

cd /dev/printer/usb
cp /boot/home/Desktop/PrintedToFile.prn 0

The known good PCL3 file outputs correctly. The "Printed To File" output a 100% black page from the printer.

in reply to:  2 ; comment:7 by dru_ed, 14 years ago

Replying to laplace:

Out of curiosity, why do you want to use the driver from BeOS R5. Isn't the Haiku PCL5 driver at least on par?

The printer is PCL4 and the BeOS R5 driver is known to work correctly. The Haiku PCL5 driver outputs incorrectly for the printer.

As an example, instead of a StyledEdit page of text with 1 inch margins, it will actually print the first paragraph over and over down the page with text cut off by the left and right margins. This is why I wanted to try the R5 driver.

in reply to:  7 ; comment:8 by laplace, 14 years ago

As an example, instead of a StyledEdit page of text with 1 inch margins, it will actually print the first paragraph over and over down the page with text cut off by the left and right margins. This is why I wanted to try the R5 driver.

Do you want to create a new ticket for that and if possible attach the image of the scanned printed page, and the file used in StyledEdit?

IIRC the Haiku PCL5 driver should be backwards compatible to PCL3, so it should work with your printer. Last time I tested it was with a HP DeskJet 500 connected to parallel port and in BeOS R5. Unfortunately I don't own a Haiku compatible printer anymore, so I had no chance to test it in Haiku.

in reply to:  8 ; comment:9 by dru_ed, 14 years ago

patch: 0

Replying to laplace:

Do you want to create a new ticket for that and if possible attach the image of the scanned printed page, and the file used in StyledEdit?

Done. See Ticket 6008: http://dev.haiku-os.org/ticket/6008

in reply to:  9 comment:10 by laplace, 14 years ago

Replying to dru_ed:

Done. See Ticket 6008: http://dev.haiku-os.org/ticket/6008

Thank you!

in reply to:  5 comment:11 by korli, 14 years ago

Replying to laplace:

It actually makes more sense to store the installed printers in the common settings folder. In a multi-user environment you probably want the printers to be shared by all users and not to be user specific.

I would actually prefer to be able to choose between common vs user printer. For instance, a printer could be used by only one user.

comment:12 by modeenf, 4 years ago

should we support this?

Note: See TracTickets for help on using tickets.