Giter Site home page Giter Site logo

sedrubal / brother_printer_fwupd Goto Github PK

View Code? Open in Web Editor NEW
30.0 3.0 5.0 266 KB

Script to update the firmware of some Brother printers

Home Page: https://pypi.org/project/brother_printer_fwupd/

License: GNU General Public License v3.0

Python 100.00%
brother mfc printer firmware updater snmp

brother_printer_fwupd's People

Contributors

dlenski avatar nuclearcat avatar sedrubal avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

brother_printer_fwupd's Issues

sorta broken with MFC-L3750CDW

←[34m[i] Querying printer info via SNMP.←[0m
←[34m[i]  Detected MFC-L3750CDW series with following firmware version(s): MAIN @ W2109141139:E619, SUB1 @ 1.59, SUB5 @ 1.00←[0m
←[34m[i] Querying firmware download URL from Brother update API.←[0m
←[31m[!] Did not receive download url for MAIN.←[0m
←[31m[!] Either this firmware part is up to date or there is a bug.←[0m
←[31m[!] This is the response of Brother's update API:←[0m
←[31m[!] <?xml version="1.0" encoding="UTF-8" ?><RESPONSEINFO></RESPONSEINFO>←[0m
←[31m[!] Did not receive download url for SUB1.←[0m
←[31m[!] Either this firmware part is up to date or there is a bug.←[0m
←[31m[!] This is the response of Brother's update API:←[0m
←[31m[!] <?xml version="1.0" encoding="UTF-8" ?><RESPONSEINFO></RESPONSEINFO>←[0m
←[31m[!] Unknown versioncheck response for firmid='SUB5'.←[0m
←[31m[!] There seems to be a bug. Open an issue!←[0m
←[31m[!] This is the response of Brother's update API:←[0m
←[31m[!] <?xml version="1.0" encoding="UTF-8" ?><RESPONSEINFO><FIRMUPDATEINFO><VERSIONCHECK>2</VERSIONCHECK><FIRMID>SUB5</FIRMID></FIRMUPDATEINFO></RESPONSEINFO>←[0m
←[32m[i] Done.←[0m

No luck with HL-L2375DW

[i] Querying printer info via SNMP.
[i]  Detected HL-L2375DW series with following firmware version(s): MAIN @ 1.40, SUB5 @ 1.04
[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>
[!] Unknown versioncheck response for firmid='SUB5'.
[!] 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><FIRMID>SUB5</FIRMID></FIRMUPDATEINFO></RESPONSEINFO>
[i] Done.

Exception swallowed and thus hides real bug

I tried this on my MFC-J430W and got an error:

[i] Querying printer info via SNMP.
[i]   Detected MFC-J430W with 1 firmware parts.
[i] Querying firmware download URL from brother update API.
[!] Did not receive any url.
[!] Maybe the firmware is already up to date or there is a bug.
[!] This is the response of brothers update API:
<?xml version="1.0" encoding="UTF-8" ?><RESPONSEINFO><FIRMUPDATEINFO><VERSIONCHECK>0</VERSIONCHECK><MEMORYVERSION>a</MEMORYVERSION><FIRMID>FIRM</FIRMID><LATESTVERSION>L1305070834</LATESTVERSION><PATH>http://update-akamai.brother.co.jp/CS/LZ3827_L.djf</PATH><DLTIME>130000</DLTIME></FIRMUPDATEINFO></RESPONSEINFO>

After reading the code, it was clear that it should have worked. I changed the error handling to actually capture and print the exception:

diff --git a/brother_printer_fwupd.py b/brother_printer_fwupd.py
index 6ae68e2..a8e6cc5 100755
--- a/brother_printer_fwupd.py
+++ b/brother_printer_fwupd.py
@@ -179,11 +179,12 @@ def get_download_url(printer_info: PrinterInfo) -> str:
     try:
         resp_xml = BeautifulSoup(resp.text, "xml")
         return resp_xml.find('PATH').text
-    except:
+    except BaseException as e:
         print('[!] Did not receive any url.', file=sys.stderr)
         print('[!] Maybe the firmware is already up to date or there is a bug.', file=sys.stderr)
         print('[!] This is the response of brothers update API:', file=sys.stderr)
         print(resp.text)
+        print(e)
         sys.exit(1)

And now I get this:

[i] Querying printer info via SNMP.
[i]   Detected MFC-J430W with 1 firmware parts.
[i] Querying firmware download URL from brother update API.
[!] Did not receive any url.
[!] Maybe the firmware is already up to date or there is a bug.
[!] This is the response of brothers update API:
<?xml version="1.0" encoding="UTF-8" ?><RESPONSEINFO><FIRMUPDATEINFO><VERSIONCHECK>0</VERSIONCHECK><MEMORYVERSION>a</MEMORYVERSION><FIRMID>FIRM</FIRMID><LATESTVERSION>L1305070834</LATESTVERSION><PATH>http://update-akamai.brother.co.jp/CS/LZ3827_L.djf</PATH><DLTIME>130000</DLTIME></FIRMUPDATEINFO></RESPONSEINFO>
Couldn't find a tree builder with the features you requested: xml. Do you need to install a parser library?

Will figure out myself, but you might want to include this exception handling.

libxml2-dev and libxlt-dev are required for poetry build of lxml

libxml2-dev and libxlt-dev are required too for successfull build with poetry during install of lxml. Please include it in your dependensy list.
Furthermore you premise python in the version 3.9 as minimal. Is it really required? This version is very new today and is not in all distributions. I changed it to 3.7 and will probe build it with python 3.7.

Unable to update firmware

Hi, I'm having issues updating my firmware. The logs are provided below. I've tried manually creating the request without BRNET and including the serial number but neither changed the output from the server. It seems like this is the response when the printer model is not found as it's what is returned when I submit a random name instead.

Logs
[i] Querying printer info via SNMP.
[i] Detected HL-2270DW series with following firmware version(s): [email protected], [email protected]
[i] Querying firmware download URL from Brother update API.
[i] Try to get information for firmware part [email protected]
[d] Sending POST request to https://firmverup.brother.co.jp/kne_bh7_update_nt_ssl/ifax2.asmx/fileUpdate with following content:
<?xml version="1.0" encoding="utf-8"?>
<REQUESTINFO>
<FIRMUPDATETOOLINFO>
<FIRMCATEGORY>MAIN</FIRMCATEGORY>
<OS>LINUX</OS>
<INSPECTMODE>1</INSPECTMODE>
</FIRMUPDATETOOLINFO>
<FIRMUPDATEINFO>
<MODELINFO>
<SERIALNO/>
<NAME>HL-2270DW series</NAME>
<SPEC></SPEC>
<DRIVER/>
<FIRMINFO><FIRM><ID>MAIN</ID><VERSION>1.19</VERSION></FIRM><FIRM><ID>BRNET</ID><VERSION>1.11</VERSION></FIRM></FIRMINFO>
</MODELINFO>
<DRIVERCNT>1</DRIVERCNT>
<LOGNO>2</LOGNO>
<ERRBIT/>
<NEEDRESPONSE>1</NEEDRESPONSE>
</FIRMUPDATEINFO>
</REQUESTINFO>
[d] Response:
<?xml version="1.0" encoding="UTF-8" ?><RESPONSEINFO><FIRMUPDATEINFO><VERSIONCHECK>2</VERSIONCHECK><FIRMID>MAIN</FIRMID></FIRMUPDATEINFO></RESPONSEINFO>
[!] Received versioncheck value '2' for firmware part MAIN. I'm sorry, but I don't know, what Brother wants to say with this code. If you have any information, please open an issue on GitHub: https://github.com/sedrubal/brother_printer_fwupd/issues/new
[i] Try to get information for firmware part [email protected]
[d] Sending POST request to https://firmverup.brother.co.jp/kne_bh7_update_nt_ssl/ifax2.asmx/fileUpdate with following content:
<?xml version="1.0" encoding="utf-8"?>
<REQUESTINFO>
<FIRMUPDATETOOLINFO>
<FIRMCATEGORY>BRNET</FIRMCATEGORY>
<OS>LINUX</OS>
<INSPECTMODE>1</INSPECTMODE>
</FIRMUPDATETOOLINFO>
<FIRMUPDATEINFO>
<MODELINFO>
<SERIALNO/>
<NAME>HL-2270DW series</NAME>
<SPEC></SPEC>
<DRIVER/>
<FIRMINFO><FIRM><ID>MAIN</ID><VERSION>1.19</VERSION></FIRM><FIRM><ID>BRNET</ID><VERSION>1.11</VERSION></FIRM></FIRMINFO>
</MODELINFO>
<DRIVERCNT>1</DRIVERCNT>
<LOGNO>2</LOGNO>
<ERRBIT/>
<NEEDRESPONSE>1</NEEDRESPONSE>
</FIRMUPDATEINFO>
</REQUESTINFO>
[d] Response:
<?xml version="1.0" encoding="UTF-8" ?><RESPONSEINFO><FIRMUPDATEINFO><VERSIONCHECK>2</VERSIONCHECK></FIRMUPDATEINFO></RESPONSEINFO>
[!] Received versioncheck value '2' for firmware part BRNET. I'm sorry, but I don't know, what Brother wants to say with this code. If you have any information, please open an issue on GitHub: https://github.com/sedrubal/brother_printer_fwupd/issues/new
[i] Done.

Support for ADS-4700W

  1. it has a fun line in the snmpwalk output:
SNMPv2-SMI::enterprises.2435.2.4.3.99.3.1.6.1.2.11 = STRING: "^L"

For this I adapted the code from:

            if not data:
                break

to

            if not data or data == "^L":
                break
  1. no matter if FIRMID is set to MAIN or SUB3 and the response for the query is:
<?xml version="1.0" encoding="UTF-8" ?><RESPONSEINFO><FIRMUPDATEINFO><VERSIONCHECK>2</VERSIONCHECK></FIRMUPDATEINFO></RESPONSEINFO>

DCP-L3550CDW empty Sub5

Using version 0.4.2 (from pypi) I get this - not sure what it means

`brother_printer_fwupd --debug -p 192.168.1.32
[i] Querying printer info via SNMP.
[i] Detected DCP-L3550CDW series with following firmware version(s): MAIN@Z2203011303:5323, [email protected], [email protected]
[i] Querying firmware download URL from Brother update API.
[d] Sending POST request to https://firmverup.brother.co.jp/kne_bh7_update_nt_ssl/ifax2.asmx/fileUpdate with following content:

MAIN LINUX 1
<FIRMUPDATEINFO>
    <MODELINFO>
        <SERIALNO></SERIALNO>
        <NAME>DCP-L3550CDW series</NAME>
        <SPEC>0103</SPEC>
        <DRIVER></DRIVER>
        <FIRMINFO>
            
    <FIRM>
        <ID>MAIN</ID>
        <VERSION>Z2203011303:5323</VERSION>
    </FIRM>
    
    <FIRM>
        <ID>SUB1</ID>
        <VERSION>1.60</VERSION>
    </FIRM>
    
    <FIRM>
        <ID>SUB5</ID>
        <VERSION>1.00</VERSION>
    </FIRM>
    
        </FIRMINFO>
    </MODELINFO>
    <DRIVERCNT>1</DRIVERCNT>
    <LOGNO>2</LOGNO>
    <ERRBIT></ERRBIT>
    <NEEDRESPONSE>1</NEEDRESPONSE>
</FIRMUPDATEINFO>

[d] Response:

[!] Did not receive download url for MAIN.
[!] Either this firmware part is up to date or there is a bug.
[d] Sending POST request to https://firmverup.brother.co.jp/kne_bh7_update_nt_ssl/ifax2.asmx/fileUpdate with following content:

SUB1 LINUX 1
<FIRMUPDATEINFO>
    <MODELINFO>
        <SERIALNO></SERIALNO>
        <NAME>DCP-L3550CDW series</NAME>
        <SPEC>0103</SPEC>
        <DRIVER></DRIVER>
        <FIRMINFO>
            
    <FIRM>
        <ID>MAIN</ID>
        <VERSION>Z2203011303:5323</VERSION>
    </FIRM>
    
    <FIRM>
        <ID>SUB1</ID>
        <VERSION>1.60</VERSION>
    </FIRM>
    
    <FIRM>
        <ID>SUB5</ID>
        <VERSION>1.00</VERSION>
    </FIRM>
    
        </FIRMINFO>
    </MODELINFO>
    <DRIVERCNT>1</DRIVERCNT>
    <LOGNO>2</LOGNO>
    <ERRBIT></ERRBIT>
    <NEEDRESPONSE>1</NEEDRESPONSE>
</FIRMUPDATEINFO>

[d] Response:

1SUB1

[i] Firmware part SUB1 seems to be up to date.
[d] Sending POST request to https://firmverup.brother.co.jp/kne_bh7_update_nt_ssl/ifax2.asmx/fileUpdate with following content:

SUB5 LINUX 1
<FIRMUPDATEINFO>
    <MODELINFO>
        <SERIALNO></SERIALNO>
        <NAME>DCP-L3550CDW series</NAME>
        <SPEC>0103</SPEC>
        <DRIVER></DRIVER>
        <FIRMINFO>
            
    <FIRM>
        <ID>MAIN</ID>
        <VERSION>Z2203011303:5323</VERSION>
    </FIRM>
    
    <FIRM>
        <ID>SUB1</ID>
        <VERSION>1.60</VERSION>
    </FIRM>
    
    <FIRM>
        <ID>SUB5</ID>
        <VERSION>1.00</VERSION>
    </FIRM>
    
        </FIRMINFO>
    </MODELINFO>
    <DRIVERCNT>1</DRIVERCNT>
    <LOGNO>2</LOGNO>
    <ERRBIT></ERRBIT>
    <NEEDRESPONSE>1</NEEDRESPONSE>
</FIRMUPDATEINFO>

[d] Response:

2SUB5

[!] Unknown versioncheck response for firmid=SUB5.
[!] There seems to be a bug.
[!] Open an issue with the full debug output: https://github.com/sedrubal/brother_printer_fwupd/issues/new
[i] Done.
`

Doc error

Hi,
Just to warn that in the README is written:
pip install --user --upgrade brother-printer-fwupd
while actually, the package is named with underscores, not dash. It should be:
pip install --user --upgrade brother_printer_fwupd

By the way, it worked with my printer, although already up to date: DCP-9020CDW

MFC-L3750CDW

This tool doesn't work with MFC-L3750CDW – but https://github.com/CauldronDevelopmentLLC/oh-brother does

The difference seems to be in the XML request being sent:

  1. In <MODELINFO>, your tool sends <SERIALNO></SERIALNO>, that other tool sends <SELIALNO> (yes terrible spelling is necessary) with the actual printer serial as contents
  2. Your tools sends <DRIVER></DRIVER>, theirs sends <DRIVER>EWS</DRIVER>

Your tool doesn't get back a response, that other tool gets something like this:

<?xml version="1.0" encoding="UTF-8" ?><RESPONSEINFO><FIRMUPDATEINFO><VERSIONCHECK>0</VERSIONCHECK><MEMORYVERSION>a</MEMORYVERSION><FIRMID>MAIN</FIRMID><LATESTVERSION>ZD2307031905</LATESTVERSION><PATH>http://update-akamai.brother.co.jp/CS/D00KJY_ZD.djf</PATH><DLTIME>180000</DLTIME></FIRMUPDATEINFO></RESPONSEINFO>

Document which settings the script expects on the printer

e.g. it expects SNMP to be enabled and configured with snmp v2c. A security focused person might set this to v3 or have the service off completely. which of the other services in network -> network -> protocol does it actually use for uploading the firmware file?

[!] poll error: Traceback (pyasn: TypeError: decodeMessageVersion.<locals>.<lambda>() takes 3 positional arguments but 4 were given)

Executing brother_printer_fwupd --printer=10.13.1.212 results in:

[i] Querying printer info via SNMP.
[!] poll error: Traceback (most recent call last):
;  File "/nix/store/83ig1ly53ywsdzrl786mlfbbl5yvwkkg-python3.10-pysnmp-4.4.12/lib/python3.10/site-packages/pysnmp/carrier/asyncore/dispatch.py", line 45, in runDispatcher
    loop(timeout or self.getTimerResolution(),
;  File "/nix/store/vagb0sjv83ybi435i6iiv10hjrdghph9-python3-3.10.12/lib/python3.10/asyncore.py", line 214, in loop
    poll_fun(timeout, map)
;  File "/nix/store/vagb0sjv83ybi435i6iiv10hjrdghph9-python3-3.10.12/lib/python3.10/asyncore.py", line 195, in poll2
    readwrite(obj, flags)
;  File "/nix/store/vagb0sjv83ybi435i6iiv10hjrdghph9-python3-3.10.12/lib/python3.10/asyncore.py", line 130, in readwrite
    obj.handle_error()
;  File "/nix/store/vagb0sjv83ybi435i6iiv10hjrdghph9-python3-3.10.12/lib/python3.10/asyncore.py", line 115, in readwrite
    obj.handle_read_event()
;  File "/nix/store/vagb0sjv83ybi435i6iiv10hjrdghph9-python3-3.10.12/lib/python3.10/asyncore.py", line 427, in handle_read_event
    self.handle_read()
;  File "/nix/store/83ig1ly53ywsdzrl786mlfbbl5yvwkkg-python3.10-pysnmp-4.4.12/lib/python3.10/site-packages/pysnmp/carrier/asyncore/dgram/base.py", line 170, in handle_read
    self._cbFun(self, transportAddress, incomingMessage)
;  File "/nix/store/83ig1ly53ywsdzrl786mlfbbl5yvwkkg-python3.10-pysnmp-4.4.12/lib/python3.10/site-packages/pysnmp/carrier/base.py", line 84, in _cbFun
    self.__recvCallables[recvId](
;  File "/nix/store/83ig1ly53ywsdzrl786mlfbbl5yvwkkg-python3.10-pysnmp-4.4.12/lib/python3.10/site-packages/pysnmp/entity/engine.py", line 151, in __receiveMessageCbFun
    self.msgAndPduDsp.receiveMessage(
;  File "/nix/store/83ig1ly53ywsdzrl786mlfbbl5yvwkkg-python3.10-pysnmp-4.4.12/lib/python3.10/site-packages/pysnmp/proto/rfc3412.py", line 291, in receiveMessage
    msgVersion = verdec.decodeMessageVersion(wholeMsg)
;  File "/nix/store/83ig1ly53ywsdzrl786mlfbbl5yvwkkg-python3.10-pysnmp-4.4.12/lib/python3.10/site-packages/pysnmp/proto/api/verdec.py", line 15, in decodeMessageVersion
    seq, wholeMsg = decoder.decode(
;  File "/nix/store/26w8jlhl89mfv901wpz9ry6ff0yljik0-python3.10-pyasn1-0.5.0/lib/python3.10/site-packages/pyasn1/codec/ber/decoder.py", line 2003, in __call__
    for asn1Object in streamingDecoder:
;  File "/nix/store/26w8jlhl89mfv901wpz9ry6ff0yljik0-python3.10-pyasn1-0.5.0/lib/python3.10/site-packages/pyasn1/codec/ber/decoder.py", line 1918, in __iter__
    for asn1Object in self._singleItemDecoder(
;  File "/nix/store/26w8jlhl89mfv901wpz9ry6ff0yljik0-python3.10-pyasn1-0.5.0/lib/python3.10/site-packages/pyasn1/codec/ber/decoder.py", line 1778, in __call__
    for value in concreteDecoder.valueDecoder(
;  File "/nix/store/26w8jlhl89mfv901wpz9ry6ff0yljik0-python3.10-pyasn1-0.5.0/lib/python3.10/site-packages/pyasn1/codec/ber/decoder.py", line 654, in valueDecoder
    for chunk in substrateFun(asn1Object, substrate, length, options):
;TypeError: decodeMessageVersion.<locals>.<lambda>() takes 3 positional arguments but 4 were given
caused by <class 'TypeError'>: decodeMessageVersion.<locals>.<lambda>() takes 3 positional arguments but 4 were given
[!] This might be a bug.

Running on NixOS, with:

  • Python 3.10
  • pysnmp 4.4.12
  • pyasn1 0.5.0

Not working for HL-L2360DW (VERSIONCHECK=2)

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

HL-L3230CDW // Unknown versioncheck response for firmid=SUB5

Hi sedrubal,

great Job that you are able to separate the tasks of the update utility. According to the Brother Homepage my printer has a firmware available (1.37) but the update utility is unable to find a printer in the network. Your script did not receive an udpate URL. Possible that the request XML differs for the HL-L3230CDW?

Thank you.

brother_printer_fwupd -p 172.31.255.210 --debug
[i] Querying printer info via SNMP.
[i] Detected HL-L3230CDW series with following firmware version(s): [email protected], [email protected]
[i] Querying firmware download URL from Brother update API.
[d] Sending POST request to https://firmverup.brother.co.jp/kne_bh7_update_nt_ssl/ifax2.asmx/fileUpdate with following content:

MAIN LINUX 1
<FIRMUPDATEINFO>
    <MODELINFO>
        <SERIALNO></SERIALNO>
        <NAME>HL-L3230CDW series</NAME>
        <SPEC>0203</SPEC>
        <DRIVER></DRIVER>
        <FIRMINFO>

    <FIRM>
        <ID>MAIN</ID>
        <VERSION>1.34</VERSION>
    </FIRM>

    <FIRM>
        <ID>SUB5</ID>
        <VERSION>1.00</VERSION>
    </FIRM>

        </FIRMINFO>
    </MODELINFO>
    <DRIVERCNT>1</DRIVERCNT>
    <LOGNO>2</LOGNO>
    <ERRBIT></ERRBIT>
    <NEEDRESPONSE>1</NEEDRESPONSE>
</FIRMUPDATEINFO>

[d] Response:

[!] Did not receive download url for MAIN.
[!] Either this firmware part is up to date or there is a bug.
[d] Sending POST request to https://firmverup.brother.co.jp/kne_bh7_update_nt_ssl/ifax2.asmx/fileUpdate with following content:

SUB5 LINUX 1
<FIRMUPDATEINFO>
    <MODELINFO>
        <SERIALNO></SERIALNO>
        <NAME>HL-L3230CDW series</NAME>
        <SPEC>0203</SPEC>
        <DRIVER></DRIVER>
        <FIRMINFO>

    <FIRM>
        <ID>MAIN</ID>
        <VERSION>1.34</VERSION>
    </FIRM>

    <FIRM>
        <ID>SUB5</ID>
        <VERSION>1.00</VERSION>
    </FIRM>

        </FIRMINFO>
    </MODELINFO>
    <DRIVERCNT>1</DRIVERCNT>
    <LOGNO>2</LOGNO>
    <ERRBIT></ERRBIT>
    <NEEDRESPONSE>1</NEEDRESPONSE>
</FIRMUPDATEINFO>

[d] Response:

2

[!] Unknown versioncheck response for firmid=SUB5.
[!] There seems to be a bug.
[!] Open an issue with the full debug output: https://github.com/sedrubal/brother_printer_fwupd/issues/new
[i] Done.

[bug] getting stack-trace after selecting brother printer for update

I'm getting this stack-tracke after installing the script using pip, running it and selecting my brother MFC9332CDW Printer (which was found).

I'm running ubuntu 22.04 (jammy).

[i] Querying printer info via SNMP.
[!] poll error: Traceback (most recent call last):
;  File "/home/gabriel/.local/lib/python3.10/site-packages/pysnmp/carrier/asyncore/dispatch.py", line 45, in runDispatcher
    loop(timeout or self.getTimerResolution(),
;  File "/usr/lib/python3.10/asyncore.py", line 214, in loop
    poll_fun(timeout, map)
;  File "/usr/lib/python3.10/asyncore.py", line 195, in poll2
    readwrite(obj, flags)
;  File "/usr/lib/python3.10/asyncore.py", line 130, in readwrite
    obj.handle_error()
;  File "/usr/lib/python3.10/asyncore.py", line 115, in readwrite
    obj.handle_read_event()
;  File "/usr/lib/python3.10/asyncore.py", line 427, in handle_read_event
    self.handle_read()
;  File "/home/gabriel/.local/lib/python3.10/site-packages/pysnmp/carrier/asyncore/dgram/base.py", line 170, in handle_read
    self._cbFun(self, transportAddress, incomingMessage)
;  File "/home/gabriel/.local/lib/python3.10/site-packages/pysnmp/carrier/base.py", line 84, in _cbFun
    self.__recvCallables[recvId](
;  File "/home/gabriel/.local/lib/python3.10/site-packages/pysnmp/entity/engine.py", line 151, in __receiveMessageCbFun
    self.msgAndPduDsp.receiveMessage(
;  File "/home/gabriel/.local/lib/python3.10/site-packages/pysnmp/proto/rfc3412.py", line 291, in receiveMessage
    msgVersion = verdec.decodeMessageVersion(wholeMsg)
;  File "/home/gabriel/.local/lib/python3.10/site-packages/pysnmp/proto/api/verdec.py", line 15, in decodeMessageVersion
    seq, wholeMsg = decoder.decode(
;  File "/home/gabriel/.local/lib/python3.10/site-packages/pyasn1/codec/ber/decoder.py", line 2003, in __call__
    for asn1Object in streamingDecoder:
;  File "/home/gabriel/.local/lib/python3.10/site-packages/pyasn1/codec/ber/decoder.py", line 1918, in __iter__
    for asn1Object in self._singleItemDecoder(
;  File "/home/gabriel/.local/lib/python3.10/site-packages/pyasn1/codec/ber/decoder.py", line 1778, in __call__
    for value in concreteDecoder.valueDecoder(
;  File "/home/gabriel/.local/lib/python3.10/site-packages/pyasn1/codec/ber/decoder.py", line 654, in valueDecoder
    for chunk in substrateFun(asn1Object, substrate, length, options):
;TypeError: decodeMessageVersion.<locals>.<lambda>() takes 3 positional arguments but 4 were given
caused by <class 'TypeError'>: decodeMessageVersion.<locals>.<lambda>() takes 3 positional arguments but 4 were given
[!] This might be a bug.

[!] Unknown versioncheck response for firmid=FIRM.

I'm getting this bug trying to run on macOS Catalina Version 10.15.7, with brother_printer_fwupd installed with Homebrew and Python 3.9.13

Here's the debug output:

RadioMac:~ thebitmaster$ brother_printer_fwupd -p 192.168.11.162 --debug

[i] Querying printer info via SNMP.
[i] Detected MFC-J480DW with following firmware version(s): FIRM@N1901041316:79BC
[i] Querying firmware download URL from Brother update API.
[d] Sending POST request to https://firmverup.brother.co.jp/kne_bh7_update_nt_ssl/ifax2.asmx/fileUpdate with following content:

FIRM MAC 1
<FIRMUPDATEINFO>
    <MODELINFO>
        <SERIALNO></SERIALNO>
        <NAME>MFC-J480DW</NAME>
        <SPEC>0001</SPEC>
        <DRIVER></DRIVER>
        <FIRMINFO>
            
    <FIRM>
        <ID>FIRM</ID>
        <VERSION>N1901041316:79BC</VERSION>
    </FIRM>
    
        </FIRMINFO>
    </MODELINFO>
    <DRIVERCNT>1</DRIVERCNT>
    <LOGNO>2</LOGNO>
    <ERRBIT></ERRBIT>
    <NEEDRESPONSE>1</NEEDRESPONSE>
</FIRMUPDATEINFO>

[d] Response:

2

[!] Unknown versioncheck response for firmid=FIRM.
[!] There seems to be a bug.
[!] Open an issue with the full debug output: https://github.com/sedrubal/brother_printer_fwupd/issues/new
[i] Done.

I'm interested in getting this to work because Brother just pushed out a firmware update that disables the ability to use aftermarket printer cartridges, which I had just installed. It seems like there's a way to get access to older firmware using a variation of this script.

Unknown versioncheck response for firmid=FIRM.

Description:

The update also fails on the web-client. I guess Brother made an error with Firmware "Q" for my MFC-J5625

Command:

brother_printer_fwupd 

Output:

Discovering printer via MDNS.
Service OKI-MC573-C1BDC1._pdl-datastream._tcp.local. added
Service Brother MFC-J5625DW._pdl-datastream._tcp.local. added
Querying printer info via SNMP.
Detected MFC-J5625DW with following firmware version(s): FIRM@Q2003042157:4BBD
Querying firmware download URL from Brother update API.
Sending POST request to https://firmverup.brother.co.jp/kne_bh7_update_nt_ssl/ifax2.asmx/fileUpdate with following content:

<REQUESTINFO>
    <FIRMUPDATETOOLINFO>
        <FIRMCATEGORY>FIRM</FIRMCATEGORY>
        <OS>LINUX</OS>
        <INSPECTMODE>1</INSPECTMODE>
    </FIRMUPDATETOOLINFO>

    <FIRMUPDATEINFO>
        <MODELINFO>
            <SERIALNO></SERIALNO>
            <NAME>MFC-J5625DW</NAME>
            <SPEC>0203</SPEC>
            <DRIVER></DRIVER>
            <FIRMINFO>
                
        <FIRM>
            <ID>FIRM</ID>
            <VERSION>Q2003042157:4BBD</VERSION>
        </FIRM>
        
            </FIRMINFO>
        </MODELINFO>
        <DRIVERCNT>1</DRIVERCNT>
        <LOGNO>2</LOGNO>
        <ERRBIT></ERRBIT>
        <NEEDRESPONSE>1</NEEDRESPONSE>
    </FIRMUPDATEINFO>
</REQUESTINFO>

Response:
<?xml version="1.0" encoding="UTF-8" ?><RESPONSEINFO><FIRMUPDATEINFO><VERSIONCHECK>2</VERSIONCHECK></FIRMUPDATEINFO></RESPONSEINFO>
Unknown versioncheck response for firmid=FIRM.

Exception:

Traceback (most recent call last):
  File "/home/martin/.local/lib/python3.11/site-packages/brother_printer_fwupd/__main__.py", line 147, in main
    run()
  File "/home/martin/.local/lib/python3.11/site-packages/brother_printer_fwupd/__main__.py", line 199, in run
    download_url = get_download_url(
                   ^^^^^^^^^^^^^^^^^
  File "/home/martin/.local/lib/python3.11/site-packages/brother_printer_fwupd/firmware_downloader.py", line 81, in get_download_url
    raise ValueError(f"Unknown versioncheck response for firmid={firmid}.")
ValueError: Unknown versioncheck response for firmid=FIRM.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.