WiPy icon indicating copy to clipboard operation
WiPy copied to clipboard

Lots of errors

Open fnoop opened this issue 5 years ago • 2 comments

Hi, a very simple test script running under python3.7 runs perfectly in PyRIC, gets lots of errors in your fork. This is the test code:

try:
        card = pyw.getcard(i)
        print("Card info: {}".format(repr(card)))
        devinfo = pyw.devinfo(i)
        print("Dev info: {}".format(repr(devinfo)))
        ifinfo = pyw.ifinfo(card)
        print("Interface info: {}".format(repr(ifinfo)))
        phyinfo = pyw.phyinfo(card)
        #print("Physical info: {}".format(repr(phyinfo)))
        for phy in phyinfo:
            print("{}: {}".format(phy, phyinfo[phy]))
        print("Card Up? '{}'".format(pyw.isup(card)))
        print("Card Blocked? '{}'".format(pyw.isblocked(card)))
        
        print("PM enabled? {}".format(pyw.pwrsaveget(card)))
        print("TX: {}".format(pyw.txget(card)))
        print("Standards: {}".format(pyw.devstds(card)))
        print()
    except pyric.error as e:
        print("Error: {}".format(repr(e)))

These are the errors:

Traceback (most recent call last):
  File "/srv/maverick/code/networking/pyric/pyw.py", line 1216, in devinfo
    dev = card.dev
AttributeError: 'str' object has no attribute 'dev'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "./hybrid-test.py", line 15, in winfo
    card = pyw.getcard(i)
  File "/srv/maverick/code/networking/pyric/pyw.py", line 448, in getcard
    return _nlstub_(getcard, dev)
  File "/srv/maverick/code/networking/pyric/pyw.py", line 2542, in _nlstub_
    return fct(*argv)
  File "/srv/maverick/code/networking/pyric/pyw.py", line 449, in getcard
    return devinfo(dev, nlsock)["card"]
  File "/srv/maverick/code/networking/pyric/pyw.py", line 1220, in devinfo
    idx = _ifindex_(dev)
  File "/srv/maverick/code/networking/pyric/pyw.py", line 2469, in _ifindex_
    return _iostub_(_ifindex_, dev)
  File "/srv/maverick/code/networking/pyric/pyw.py", line 2522, in _iostub_
    return fct(*argv)
  File "/srv/maverick/code/networking/pyric/pyw.py", line 2474, in _ifindex_
    return struct.unpack_from(ifr_ifindex, ret, IFNAMELEN)[0]
NameError: name 'ifr_ifindex' is not defined

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "./hybrid-test.py", line 47, in <module>
    winfo(interface)
  File "./hybrid-test.py", line 32, in winfo
    except pyric.error as e:
AttributeError: module 'pyric' has no attribute 'error'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "./hybrid-test.py", line 51, in <module>
    except pyric.error as e:
AttributeError: module 'pyric' has no attribute 'error'

fnoop avatar May 21 '19 08:05 fnoop

Output under PyRIC:

Card info: Card(phy=0,dev=wlan0,ifindex=3)
Dev info: {'card': Card(phy=0,dev=wlan0,ifindex=3), 'mode': 'managed', 'wdev': 1, 'mac': 'b8:27:eb:b7:b8:8a', 'RF': 5805, 'CF': 5805, 'CHW': 'HT20'}
Interface info: {'driver': 'Unknown', 'chipset': 'Unknown', 'hwaddr': 'b8:27:eb:b7:b8:8a', 'manufacturer': 'Raspberry Pi Foundation', 'inet': None, 'bcast': None, 'mask': None}
generation: 1
retry_short: 7
retry_long: 4
frag_thresh: off
rts_thresh: off
cov_class: 0
scan_ssids: 10
bands: {'2GHz': {'HT': True, 'VHT': False, 'rates': [1.0, 2.0, 5.5, 11.0, 6.0, 9.0, 12.0, 18.0, 24.0, 36.0, 48.0, 54.0], 'rfs': [2412, 2417, 2422, 2427, 2432, 2437, 2442, 2447, 2452, 2457, 2462, 2467, 2472, 2484], 'rf-data': [{'max-tx': 20.0, 'enabled': True, '20Mhz': True, '10Mhz': True, 'radar': False, 'not-permitted': []}, {'max-tx': 20.0, 'enabled': True, '20Mhz': True, '10Mhz': True, 'radar': False, 'not-permitted': []}, {'max-tx': 20.0, 'enabled': True, '20Mhz': True, '10Mhz': True, 'radar': False, 'not-permitted': []}, {'max-tx': 20.0, 'enabled': True, '20Mhz': True, '10Mhz': True, 'radar': False, 'not-permitted': []}, {'max-tx': 20.0, 'enabled': True, '20Mhz': True, '10Mhz': True, 'radar': False, 'not-permitted': []}, {'max-tx': 20.0, 'enabled': True, '20Mhz': True, '10Mhz': True, 'radar': False, 'not-permitted': []}, {'max-tx': 20.0, 'enabled': True, '20Mhz': True, '10Mhz': True, 'radar': False, 'not-permitted': []}, {'max-tx': 20.0, 'enabled': True, '20Mhz': True, '10Mhz': True, 'radar': False, 'not-permitted': []}, {'max-tx': 20.0, 'enabled': True, '20Mhz': True, '10Mhz': True, 'radar': False, 'not-permitted': []}, {'max-tx': 20.0, 'enabled': True, '20Mhz': True, '10Mhz': True, 'radar': False, 'not-permitted': []}, {'max-tx': 20.0, 'enabled': True, '20Mhz': True, '10Mhz': True, 'radar': False, 'not-permitted': []}, {'max-tx': 20.0, 'enabled': True, '20Mhz': True, '10Mhz': True, 'radar': False, 'not-permitted': []}, {'max-tx': 20.0, 'enabled': True, '20Mhz': True, '10Mhz': True, 'radar': False, 'not-permitted': []}, {'max-tx': 20.0, 'enabled': False, '20Mhz': True, '10Mhz': True, 'radar': False, 'not-permitted': []}]}, '5GHz': {'HT': True, 'VHT': True, 'rates': [6.0, 9.0, 12.0, 18.0, 24.0, 36.0, 48.0, 54.0], 'rfs': [5170, 5180, 5190, 5200, 5210, 5220, 5230, 5240, 5260, 5280, 5300, 5320, 5500, 5520, 5540, 5560, 5580, 5600, 5620, 5640, 5660, 5680, 5700, 5720, 5745, 5765, 5785, 5805, 5825], 'rf-data': [{'max-tx': 20.0, 'enabled': False, '20Mhz': True, '10Mhz': True, 'radar': False, 'not-permitted': []}, {'max-tx': 20.0, 'enabled': True, '20Mhz': True, '10Mhz': True, 'radar': False, 'not-permitted': []}, {'max-tx': 20.0, 'enabled': False, '20Mhz': True, '10Mhz': True, 'radar': False, 'not-permitted': []}, {'max-tx': 20.0, 'enabled': True, '20Mhz': True, '10Mhz': True, 'radar': False, 'not-permitted': []}, {'max-tx': 20.0, 'enabled': False, '20Mhz': True, '10Mhz': True, 'radar': False, 'not-permitted': []}, {'max-tx': 20.0, 'enabled': True, '20Mhz': True, '10Mhz': True, 'radar': False, 'not-permitted': []}, {'max-tx': 20.0, 'enabled': False, '20Mhz': True, '10Mhz': True, 'radar': False, 'not-permitted': []}, {'max-tx': 20.0, 'enabled': True, '20Mhz': True, '10Mhz': True, 'radar': False, 'not-permitted': []}, {'max-tx': 20.0, 'enabled': True, '20Mhz': True, '10Mhz': True, 'radar': False, 'not-permitted': []}, {'max-tx': 20.0, 'enabled': True, '20Mhz': True, '10Mhz': True, 'radar': False, 'not-permitted': []}, {'max-tx': 20.0, 'enabled': True, '20Mhz': True, '10Mhz': True, 'radar': False, 'not-permitted': []}, {'max-tx': 20.0, 'enabled': True, '20Mhz': True, '10Mhz': True, 'radar': False, 'not-permitted': []}, {'max-tx': 20.0, 'enabled': True, '20Mhz': True, '10Mhz': True, 'radar': False, 'not-permitted': []}, {'max-tx': 20.0, 'enabled': True, '20Mhz': True, '10Mhz': True, 'radar': False, 'not-permitted': []}, {'max-tx': 20.0, 'enabled': True, '20Mhz': True, '10Mhz': True, 'radar': False, 'not-permitted': []}, {'max-tx': 20.0, 'enabled': True, '20Mhz': True, '10Mhz': True, 'radar': False, 'not-permitted': []}, {'max-tx': 20.0, 'enabled': True, '20Mhz': True, '10Mhz': True, 'radar': False, 'not-permitted': []}, {'max-tx': 20.0, 'enabled': True, '20Mhz': True, '10Mhz': True, 'radar': False, 'not-permitted': []}, {'max-tx': 20.0, 'enabled': True, '20Mhz': True, '10Mhz': True, 'radar': False, 'not-permitted': []}, {'max-tx': 20.0, 'enabled': True, '20Mhz': True, '10Mhz': True, 'radar': False, 'not-permitted': []}, {'max-tx': 20.0, 'enabled': True, '20Mhz': True, '10Mhz': True, 'radar': False, 'not-permitted': []}, {'max-tx': 20.0, 'enabled': True, '20Mhz': True, '10Mhz': True, 'radar': False, 'not-permitted': []}, {'max-tx': 20.0, 'enabled': True, '20Mhz': True, '10Mhz': True, 'radar': False, 'not-permitted': []}, {'max-tx': 20.0, 'enabled': True, '20Mhz': True, '10Mhz': True, 'radar': False, 'not-permitted': []}, {'max-tx': 20.0, 'enabled': True, '20Mhz': True, '10Mhz': True, 'radar': False, 'not-permitted': []}, {'max-tx': 20.0, 'enabled': True, '20Mhz': True, '10Mhz': True, 'radar': False, 'not-permitted': []}, {'max-tx': 20.0, 'enabled': True, '20Mhz': True, '10Mhz': True, 'radar': False, 'not-permitted': []}, {'max-tx': 20.0, 'enabled': True, '20Mhz': True, '10Mhz': True, 'radar': False, 'not-permitted': []}, {'max-tx': 20.0, 'enabled': True, '20Mhz': True, '10Mhz': True, 'radar': False, 'not-permitted': []}]}}
modes: ['ibss', 'managed', 'AP', 'p2p_client', 'p2p_go', 'p2p_device']
swmodes: []
commands: ['new_interface', 'set_interface', 'new_key', 'start_ap', 'join_ibss', 'set_pmksa', 'del_pmksa', 'flush_pmksa', 'remain_on_channel', 'frame', 'set_wiphy_netns', 'set_channel', 'tdls_oper', 'start_sched_scan', 'start_p2p_device', 'connect', 'disconnect']
ciphers: ['WEP-40', 'WEP-104', 'TKIP', 'CCMP', 'AES-CMAC']
Card Up? 'True'
Card Blocked? '(False, False)'
PM enabled? True
TX: 10
Standards: ['a', 'b', 'g', 'n']

fnoop avatar May 21 '19 08:05 fnoop

That sample seems to work (save for the pyw.txget call) in RHEL8, python 3.6 (from the RH repo), and the 12/9/2019 commit on my Zbook 17 with its integrated Intel 8265 wifi. Deployed it this way:

$ python3 -m venv --system-site-packages wipy_venv
$ source wipy_venv/bin/activate
$ pip install dataclasses
$ pip install -e .

qhaas avatar Oct 21 '20 14:10 qhaas