sedrubal / brother_printer_fwupd

Script to update the firmware of some Brother printers
https://pypi.org/project/brother_printer_fwupd/
GNU General Public License v3.0
30 stars 5 forks source link

Not working for HL-L2360DW (VERSIONCHECK=2) #20

Closed dlenski closed 4 months ago

dlenski commented 4 months ago

This printer identifies itself in a slightly strange way, as MODEL=HL-L2360D series:

snmpwalk -v 2c -c public 192.168.4.120 iso.3.6.1.4.1.2435.2.4.3.99.3.1.6.1.2
iso.3.6.1.4.1.2435.2.4.3.99.3.1.6.1.2.1 = STRING: "MODEL=\"HL-L2360D series\""
iso.3.6.1.4.1.2435.2.4.3.99.3.1.6.1.2.2 = STRING: "SERIAL=\"******************\""
iso.3.6.1.4.1.2435.2.4.3.99.3.1.6.1.2.3 = STRING: "SPEC=\"0102\""
iso.3.6.1.4.1.2435.2.4.3.99.3.1.6.1.2.4 = STRING: "DEMOID=\"?\""
iso.3.6.1.4.1.2435.2.4.3.99.3.1.6.1.2.5 = STRING: "FONT=\"?\""
iso.3.6.1.4.1.2435.2.4.3.99.3.1.6.1.2.6 = STRING: "FIRMID=\"MAIN\""
iso.3.6.1.4.1.2435.2.4.3.99.3.1.6.1.2.7 = STRING: "FIRMVER=\"1.23\""
iso.3.6.1.4.1.2435.2.4.3.99.3.1.6.1.2.8 = STRING: "FIRMID=\"SUB1\""
iso.3.6.1.4.1.2435.2.4.3.99.3.1.6.1.2.9 = STRING: "FIRMVER=\"1.11\""
iso.3.6.1.4.1.2435.2.4.3.99.3.1.6.1.2.10 = STRING: "
                                                    "
iso.3.6.1.4.1.2435.2.4.3.99.3.1.6.1.2.11 = STRING: "
                                                    "
iso.3.6.1.4.1.2435.2.4.3.99.3.1.6.1.2.12 = STRING: "
                                                    "
iso.3.6.1.4.1.2435.2.4.3.99.3.1.6.1.2.13 = STRING: "
                                                    "
iso.3.6.1.4.1.2435.2.4.3.99.3.1.6.1.2.14 = STRING: "
                                                    "
iso.3.6.1.4.1.2435.2.4.3.99.3.1.6.1.2.15 = STRING: "
                                                    "
iso.3.6.1.4.1.2435.2.4.3.99.3.1.6.1.2.16 = STRING: "
                                                    "

This leaves the tool unable to find its firmware:

$ brother_printer_fwupd -p $IP_ADDRESS --os LINUX
[i] Querying printer info via SNMP.
[i]  Detected HL-L2360D series with following firmware version(s): MAIN @ 1.23, SUB1 @ 1.11
[i] Querying firmware download URL from Brother update API.
[!] Did not receive download url for MAIN.
[!] Either this firmware part is up to date or there is a bug.
[!] This is the response of Brother's update API:
[!] <?xml version="1.0" encoding="UTF-8" ?><RESPONSEINFO></RESPONSEINFO>
[!] Did not receive download url for SUB1.
[!] Either this firmware part is up to date or there is a bug.
[!] This is the response of Brother's update API:
[!] <?xml version="1.0" encoding="UTF-8" ?><RESPONSEINFO></RESPONSEINFO>

If I override the MODEL value to simply HL-L2360D, or to HL-L2360DW, it gets slightly further, but with an unexpected VERSIONCHECK=2:

[i] Querying printer info via SNMP.
[i]  Detected HL-L2360DW with following firmware version(s): MAIN @ 1.23, SUB1 @ 1.11
[i] Querying firmware download URL from Brother update API.
[!] Unknown versioncheck response for firmid='MAIN'.
[!] There seems to be a bug. Open an issue!
[!] This is the response of Brother's update API:
[!] <?xml version="1.0" encoding="UTF-8" ?><RESPONSEINFO><FIRMUPDATEINFO><VERSIONCHECK>2</VERSIONCHECK></FIRMUPDATEINFO></RESPONSEINFO>
[!] Unknown versioncheck response for firmid='SUB1'.
[!] There seems to be a bug. Open an issue!
[!] This is the response of Brother's update API:
[!] <?xml version="1.0" encoding="UTF-8" ?><RESPONSEINFO><FIRMUPDATEINFO><VERSIONCHECK>2</VERSIONCHECK></FIRMUPDATEINFO></RESPONSEINFO>

I know that newer versions of the firmware (1.36/1.12) exist thanks to https://support.brother.com/g/b/downloadlist.aspx?c=ca&lang=en&prod=hll2360dw_us&os=10068

dlenski commented 4 months ago

For what it's worth, I'm using an old version of the tool, 332eb4f, because I'm on an old version of Python, but there don't seem to be any recent changes that would affect its ability to find the firmware for this printer… unless it needs some crazy hack akin to 565ef037ea8fd9ccc6bd0b03dd7c18120f7f17e6 :sweat_smile:

dlenski commented 4 months ago

there don't seem to be any recent changes that would affect its ability to find the firmware for this printer… unless it needs some crazy hack akin to https://github.com/sedrubal/brother_printer_fwupd/commit/565ef037ea8fd9ccc6bd0b03dd7c18120f7f17e6 😅

Should've tested it first. Yes, indeed, the misspelling-based "fixes" from 565ef037ea8fd9ccc6bd0b03dd7c18120f7f17e6 / #19 do indeed resolve this, and allow me to update the firmware successfully. :dizzy_face:

dlenski commented 4 months ago

Yes, indeed, the misspelling-based "fixes" from 565ef03 / #19 do indeed resolve this, and allow me to update the firmware successfully. 😵

Perhaps apply_mfc_l3750cdw_hack deserves a more generic name now :sob:

sedrubal commented 4 months ago

Thanks for your report and for digging into it. I'll rename the function 😉 Is there a reason why you're stuck to an old version of Python? I think the minimum Python version is quite an arbitrary decision and we can support older versions again if required.

dlenski commented 4 months ago

Is there a reason why you're stuck to an old version of Python?

Running an older Linux distribution (Ubuntu 20.04) and generally being a fan of the traditional Debian-based distros’ approach to packaging Python ("only install one copy of anything").

I think the minimum Python version is quite an arbitrary decision and we can support older versions again if required.

Cool! Adding some CI to verify that the code builds and runs with older versions would be a good way to get fast feedback on things that've broken older versions.

You can see how I do things in some of my Python projects with Github-CI, like https://github.com/dlenski/python-vipaccess/blob/master/.github/workflows/test_and_release.yml#L14