def list_set_bits(r, expected_length):
    """Return list of positions of bits set to one in given data.

    This method is used to read e.g. violated zones. They are marked by ones
    on respective bit positions - as per Satel manual.
    """
    set_bit_numbers = []
    bit_index = 1
    assert len(r) == expected_length + 1
    for b in r[1:]:
        for i in range(8):
            if b >> i & 1 == 1:
                set_bit_numbers.append(bit_index)
            bit_index += 1
    return set_bit_numbers
