Updating Brother printer firmware (part 2)

Based on my previous post, I’ve received few enquiries regarding updating different network printers.
In the SNMP walk, you should find a section with lines; MODEL, SERIAL, SPEC (optional) and FIRMID (multiple if there are more than one firmware types). If the printer is in maintenance mode then the required lines will not be present in the SNMP output, and sometime is not there at all!

Here is a list of printers which I’ve been able to retrieve.

NAME SPEC FIRMID
DCP-1510 series 0003 MAIN,SUB3
DCP-1608 0020 MAIN
DCP-1610W series 0017 MAIN
DCP-7030 0101 MAIN
DCP-7040 0001 MAIN
DCP-7055 0001 MAIN
DCP-7055W 0001 MAIN
DCP-7060D 0001 MAIN,SUB1
DCP-7065DN 3004 MAIN,SUB1
DCP-7070DW 0001 MAIN,PCLPS,SUB1
DCP-7080 0020 MAIN
DCP-7080D 0120 MAIN
DCP-8070D 0024 MAIN,PCLPS
DCP-8080DN 0001 MAIN,PCLPS
DCP-8085DN 0101 MAIN,PCLPS
HL-1110 series MAIN
HL-1200 series MAIN
HL-1208 MAIN
HL-2220 series MAIN
HL-2230 series MAIN
HL-2240 series MAIN
HL-2240D series MAIN
HL-2250DN series MAIN
HL-2270DW series MAIN
HL-3140CW series MAIN,PCLPS,SUB1
HL-3150CDW series MAIN,SUB1
HL-3170CDW series MAIN,PCLPS,SUB1
HL-5250DN series MAIN,BRNET,BRNET2
HL-5270DN series MAIN,BRNET,BRNET2
HL-5280DW series MAIN,BRNET
HL-5370DW series MAIN,BRNET
HL-5440D series 0001 MAIN
HL-5450DN series 0004 MAIN,SUB1
HL-5470DW series 0101 MAIN,SUB1
HL-S7000DN series MAIN,ENGINE,SUB1
MFC-1810 series 0003 MAIN,SUB3
MFC-1900 series 0019 MAIN
MFC-1906 0020 MAIN
MFC-1910W series 0003 MAIN
MFC-1919NW 0020 MAIN
MFC-7340 0002 MAIN
MFC-7360N 2048 MAIN,SUB1
MFC-7460DN 0001 MAIN,SUB1,IFAX
MFC-7470D MAIN,SUB1,PCLPS
MFC-7840W 0002 MAIN,IFAX
MFC-7860DN 0001 MAIN,PCLPS,SUB1,IFAX
MFC-7860DW 2248 MAIN,PCLPS,SUB1,IFAX
MFC-8370DN 2148 MAIN,PCLPS,IFAX
MFC-8520DN 0248 MAIN,SUB1,IFAX
MFC-8880DN 2348 MAIN,PCLPS
MFC-8890DW 0401 MAIN,PCLPS
MFC-9320CW 0201 MAIN,PCLPS,IFAX
MFC-9340CDW 0502 MAIN,SUB1,SUB2,IFAX
MFC-9970CDW MAIN,PCLPS,SUB2
MFC-L8600CDW MAIN,SUB1,SUB2,SUB4,IFAX

The following script performs the required HTTP requests.

#!/bin/bash
  
name=
spec=
firms=
  
while getopts ":n:s:f:" opt; do
  case $opt in
    n)
      name=$OPTARG
      ;;
    s)
      spec=$OPTARG
      ;;
    f)
      firms=$OPTARG
      ;;
  esac
done
  
IFS=',' read -a firmids <<< "$firms"
for firmid in "${firmids[@]}"
do
    for version in "0" "B0000000000"
    do
        echo -n '<REQUESTINFO><FIRMUPDATETOOLINFO><FIRMCATEGORY>' >> request.xml
        echo -n $firmid >> request.xml
        echo -n '</FIRMCATEGORY><OS>LINUX</OS><INSPECTMODE>1</INSPECTMODE></FIRMUPDATETOOLINFO><FIRMUPDATEINFO><MODELINFO><NAME>' >> request.xml
        echo -n $name >> request.xml
        echo -n '</NAME><SPEC>' >> request.xml
        echo -n $spec >> request.xml
        echo -n '</SPEC><DRIVER></DRIVER><FIRMINFO><FIRM><ID>' >> request.xml
        echo -n $firmid >> request.xml
        echo -n '</ID><VERSION>' >> request.xml
        echo -n $version >> request.xml
        echo -n '</VERSION></FIRM></FIRMINFO></MODELINFO><DRIVERCNT>1</DRIVERCNT><LOGNO>2</LOGNO><ERRBIT></ERRBIT><NEEDRESPONSE>1</NEEDRESPONSE></FIRMUPDATEINFO></REQUESTINFO>' >> request.xml
  
        curl -X POST -d @request.xml https://firmverup.brother.co.jp/kne_bh7_update_nt_ssl/ifax2.asmx/fileUpdate -H "Content-Type:text/xml" --sslv3 -o response.xml -s
        valid=`grep "<RESPONSEINFO><FIRMUPDATEINFO><VERSIONCHECK>0</VERSIONCHECK>" response.xml`
        if [ -n "$valid" ]
        then
            echo "--- request (name=$name, spec=$spec, firm=$firmid, version=$version) ---"
            cat request.xml | xmllint --format -
            echo "--- response ---"
            cat response.xml | xmllint --format -
        else
            partial=`grep "<RESPONSEINFO><FIRMUPDATEINFO><VERSIONCHECK>2</VERSIONCHECK><FIRMID>" response.xml`
            if [ -n "$partial" ]
            then
                echo "-- the request is partially incomplete (name=$name, spec=$spec, firm=$firmid, version=$version) --"
            else
                echo "-- the request is invalid (name=$name, spec=$spec, firm=$firmid, version=$version) --"
            fi
        fi
        rm request.xml response.xml
    done
done

Here is an example to fetch both firmwares for the HL-5450DN.

./fetch.sh -n "HL-5450DN series" -s 0004 -f MAIN,SUB1

*** If you have successfully retrieved the correct info from the SNMP walk; then please let me know and I’ll update this post with your printer.

Advertisements

~ by cedricbompart on May 26, 2014.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: