JetDirect Printing

I’m trying to setup my HP LaserJet with Haiku. I see the option for PCL6 and JetDirect, but nothing ever prints. I took a look at syslog and I see this:

KERN: runtime_loader: Cannot open file /boot/home/config/non-packaged/add-ons/Print/transport/HP JetDirect (needed by <NULL>): No such file or directory
KERN: runtime_loader: Cannot open file /boot/home/config/add-ons/Print/transport/HP JetDirect (needed by <NULL>): No such file or directory
KERN: runtime_loader: Cannot open file /boot/system/non-packaged/add-ons/Print/transport/HP JetDirect (needed by <NULL>): No such file or directory

Those are normal messages, I think. The system looks into all standard locations. See:

$> findpaths B_FIND_PATH_ADD_ONS_DIRECTORY
/boot/home/config/non-packaged/add-ons
/boot/home/config/add-ons
/boot/system/non-packaged/add-ons
/boot/system/add-ons

The syslog entry means the file wasn’t found in those first three locations, but eventually in the last /boot/system/add-ons - the “system” hierarchy all packages are installed by default.

It’s not the first time someone is confused by that.
IMHO, the system should report (only when nothing was found) after trying all locations but, I guess that it would be easier to make it say that the file has been found.

1 Like

I agree.
Will do a fix for these misleading log messages.

But it doesn’t explains why nothing is printed.

Edit: fix pending for review: https://review.haiku-os.org/c/haiku/+/11175

1 Like

Did you configure correctly the JetDirect transport, with the printer IP address and port (from memory it’s 9100 by default)

1 Like

Yes. My printer has a static IP and I used the default port 9100.

Use the PCL5 compatible driver
Transport: HP JetDirect
Connected to: IPP (9100 port)
Verify printer IP and port connectivity/accessibility.
Do a local test with your smartphone or another device to print using your printer over the network.
Print a test page.

Yep. You are correct. I do see the transports in /boot/system/add-ons/print

What’s weird is I can ping the printer from Haiku but can’t access the printer’s web UI. My Mac can print to it fine and load the web UI.

I went down the rabbit hole trying to figure out what the issue is.

nmap can see the open ports
I can telnet to port 9100 and it opens

There’s something funky with Haiku’s TCP window scaling, is the receive window 255 bytes?

tcpdump -i /dev/net/ipro1000/0 host 10.0.1.48
tcpdump: verbose output suppressed, use -v[v]... for full protocol decode
listening on /dev/net/ipro1000/0, link-type EN10MB (Ethernet), snapshot length 262144 bytes
09:47:22.008238 IP 10.0.1.87.42600 > 10.0.1.48.www: Flags [P.], seq 35219090:35219419, ack 2810606458, win 255, options [nop,nop,TS val 985506 ecr 1167276], length 329: HTTP: GET / HTTP/1.1
09:47:22.017152 IP 10.0.1.48.www > 10.0.1.87.42600: Flags [.], ack 329, win 11680, length 0
09:47:22.017208 ARP, Reply 10.0.1.87 is-at xx:xx:xx:xx:xx:xx (oui Unknown), length 46
09:47:22.017246 ARP, Reply 10.0.1.87 is-at xx:xx:xx:xx:xx:xx (oui Unknown), length 28

I probably need to upgrade at some point, it’s probably been resolved. I’m on hrev57937+129

I setup a CUPS server on my linux box. JetDirect port 9100

socat -v TCP-LISTEN:9100,fork,reuseaddr TCP:10.0.1.48:9100

The HP JetDirect transport add-on show an error dialog in case it fails to connect to the IP address + configured port (9100 by default)

If you don’t see such dialog, the issue is maybe not a network connectivity one.

Otherwise, it’s not available out-of-the-box in Haiku, but in the source code of Haiku, in src/tests/add-ons/print/transports folder, you’ll find a small command line tool called print_transport_loader that can be useful to check print transport add-ons behavior. Most transports add-ons emit debug messages, but as usually they’re run from print_server_addon process, they’re not visible easily. When run from this small tool, addon logs messages are visible on console output.

If you want to build it by youself, grab the Haiku git source (from Haiku mirror on GitHub for instance), then:

cd haiku
mkdir generated
cd generated
../configure
cd ..
jam print_transport_loader

The tool will be built and available then under generated/objects/haiku/<arch>/release/tests/add-ons/print/transports/print_transport_loader.

The tool can load a transport add-on for a given name, list the ports (useful for USB add-on, less for HP JetDirect as it has no auto detection feature…) and send a file over the transport, which can be useful if you manage to have a capture of a working data for your printer to produce something useful.

print_transport_loader -v 'HP JetDirect' <some_pcl5_job_file>

Almost forgot how to get a file with a test page in PCL5 command!

Create a second printer with same PCL5 driver but with “Print To File” as transport. Print a test page (from Printers preferences window), and enter a file name and location.

Another solution is to use ghostscript to convert a PDF into a raw PCL file:

gs -sDEVICE=ljet4 -sOutputFile=testpage.pcl -dNOPAUSE -dBATCH <some_file.pdf>

1 Like