incorrectly reports low ink for VIP version 3 devices

Bug #463298 reported by Tim Waugh
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
HPLIP
New
Undecided
Unassigned

Bug Description

The device ID parsing code seems to be incorrect in 3.9.8.

For this Device ID I am seeing marker-supply-low-warning state reasons:

MFG:HP;MDL:Officejet Pro
K550;CMD:MLC,PCL,PML,DESKJET,DW-PCL,DYN;CLS:PRINTER;DES:HP Officejet Pro
K550;SN:MY65D5102B;S:028080A880001000810002000300040005031605070518040;Z:031;1284.3M:f7f,f7f;1284.4DL:4d,4e,1;

whereas it seems that the device is reporting no problem.

Here is the code in question:

    if (pSS->GetVIPVersion () == 3)
    {
        for (i = 0; i < numPens; i++, pStr += 4)
        {
            switch (*pStr)
            {
                case '5':
                {
                    if ((*(pStr+1) & 0xf3) > 1)
                    {
                        if (err != NO_ERROR)
                        {
                            err = WARN_LOW_INK_MULTIPLE_PENS;
                        }
                        else
                        {
                            err = WARN_LOW_INK_BLACK;
                        }
                    }
                    break;
                }
...

Here, *(pStr+1) is '0' in each case, i.e. 0x40. This means that the test (0x40 & 0xf3) > 1 is true -- and in fact it will be for any digit.

Shouldn't it be something like this?: *(pStr+1) & 0xf3) > '1'
i.e. with single quotes around the 1 so that the test compares against 0x41 and not 0x01?

The lack of comments leaves me guessing somewhat. ;-)

Original bug report:
  https://bugzilla.redhat.com/show_bug.cgi?id=510926

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.