f.read(len) only returns a byte string. Then raw will be a single byte.
The correct way of looping is:
with open(fname, 'rb') as f:
while True:
raw = f.read(8)
if len(raw)!=8:
break # ignore the incomplete "record" if any
record = struct.unpack("HHI", raw )
print(record)