receiver: check that device can retrieve host names before trying that

This commit is contained in:
Peter F. Patel-Schneider 2020-08-12 08:52:22 -04:00
parent b3cc4361e8
commit 330fadfbce
1 changed files with 12 additions and 11 deletions

View File

@ -898,7 +898,8 @@ def get_host_names(device):
state = feature_request(device, FEATURE.HOSTS_INFO, 0x00)
host_names = {}
if state:
_ignore, _ignore, numHosts, currentHost = _unpack('!BBBB', state[:4])
capability_flags, _ignore, numHosts, currentHost = _unpack('!BBBB', state[:4])
if capability_flags & 0x01: # device can get host names
for host in range(0, numHosts):
hostinfo = feature_request(device, FEATURE.HOSTS_INFO, 0x10, host)
_ignore, status, _ignore, numPages, nameLen, _ignore = _unpack('!BBBBBB', hostinfo[:6])