Add automatic firmware loading for HP LaserJet 1018 - #2
Open
greenflute wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add an optional native macOS firmware autoloader for the HP LaserJet 1018.
The LaserJet 1018 stores its operating firmware in volatile memory. After every printer power cycle or USB re-enumeration, the firmware must be uploaded again before normal print jobs can be processed.
Without firmware, CUPS may successfully submit and complete a job while the printer remains unresponsive. The current workaround requires manually sending
sihp1018.dlafter every power cycle.This change adds an Apple Silicon-native, event-driven firmware loader that automates that process.
Reported Symptom
On macOS Tahoe running on Apple Silicon:
rastertozjsfilter and CUPS queue work correctly.sihp1018.dl.The printer requires firmware after every power cycle because it does not store the firmware persistently.
Implementation
This PR adds
foo2zjs-firmware-loader, a native C helper using macOS system frameworks only.The helper:
03f0:4117.FWVER:as the firmware-loaded indicator./usr/libexec/cups/backend/usb.The first supported device is intentionally limited to:
03f0:4117sihp1018.dlOther firmware-dependent printers are not enabled until their identifiers and firmware-loaded behavior can be verified on real hardware.
State Detection
The loader uses the IEEE-1284 Device ID exposed by the macOS CUPS USB backend.
The state is interpreted as follows:
FWVER:: firmware is loaded.FWVER:: firmware is not loaded.This avoids treating USB presence alone as proof that firmware is loaded.
The implemented state flow is:
Command-Line Modes
Inspect state without making changes:
Perform one check and upload if necessary:
Run the foreground IOKit event monitor:
Example status before upload:
Example status after upload:
LaunchDaemon
The system LaunchDaemon is installed as:
The helper is installed as:
The daemon:
launchd.launchd.Logs are written to:
The service can be inspected with:
Installation
The loader remains an explicit opt-in because the main installer currently installs drivers for 89 printer models, while automatic firmware loading has only been verified for the LaserJet 1018.
Install it independently:
Or select it as part of the main installation:
The default command remains unchanged:
It does not install a system daemon unless
--firmware-autoloadis specified.The firmware-loader installer:
root:wheelownership.launchctl bootstrapandkickstartcommands.sihp1018.dlonly when the firmware file is missing.sihp1018.dl.Uninstallation
Remove the helper and LaunchDaemon with:
Uninstallation removes only:
It leaves the following unchanged:
Hardware Testing
Tested with:
03f0:4117KP3DDRPusb://Hewlett-Packard/HP%20LaserJet%201018?serial=KP3DDRPVerified behavior:
--statusdetects the connected LaserJet 1018.not loadedbefore upload.--oncesends the complete 129143-byte firmware file.FWVER:on the first attempt.loaded.not loaded, uploads firmware once, and verifies it.rastertozjsfilter and queue PPD remain unchanged.The automatic power-cycle sequence produced:
Installed driver hashes before and after installing and testing the autoloader were identical:
This confirms that the firmware-loader installation did not overwrite the working driver or queue PPD.
Build Verification
The helper builds as a native Apple Silicon executable:
Dynamic dependencies:
The helper has no dependency on:
x86_64binariesValidation performed:
All checks passed.
Why Not the Original macOS Hotplug Implementation?
The original foo2zjs macOS helper contains useful concepts, including:
FWVERdetectionHowever, its deployment model relies on obsolete macOS mechanisms and lifecycle assumptions, including:
/etc/rc.localkillallThis implementation retains the relevant USB event and firmware-state concepts while using:
launchdlaunchctl bootstrapandbootoutcommandskIOMainPortDefaultSafety and Scope
This change is intentionally separate from raster conversion.
It does not modify:
rastertozjspage processingThe first release enables only the hardware configuration that was tested.
Known Limitations
Follow-up
The current installation is deliberately opt-in because
install.shinstalls all supported drivers and does not know which printer model the user intends to configure.A follow-up should make firmware autoload part of the default installation for a selected firmware-dependent model once the installer becomes model-aware.
The intended future behavior is:
That model-specific installation should install:
sihp1018.dl.It should also provide an explicit opt-out, for example:
sudo ./install.sh \ --model HP-LaserJet_1018 \ --no-firmware-autoloadThe future implementation must not decide solely from whether the printer is connected during installation, because the printer may be powered off or temporarily disconnected.
As support is added for other firmware-dependent models, their verified VID/PID values, firmware filenames, and loaded-state behavior should be added to the device table.
Autoload should become the normal default only for models with verified hardware behavior.
Related Driver Fix
This firmware-autoload change is intentionally independent from the separate HP LaserJet 1018 ARM64 raster/PPD resolution fix.
The autoloader does not replace or modify the raster filter or queue PPD. Hardware printing after automatic firmware upload was tested using the separately verified LaserJet 1018 ARM64 raster driver changes.
Both changes can be reviewed and merged independently, although the complete end-user installation experience requires both changes to be present.