Skip to content

turrishw: update to version 0.8.0

Martin Matějek requested to merge feature/turrishw-0.7.0 into develop

Description

Changed:

  • Return interfaces sorted based on interface name (natural sort order).
  • Turris 1.x: Improve detection of Turris 1.x routers on TOS 6.0
  • Turris 1.x: Adjust the PCIe slots paths, so wireless card can be detected again on TOS 6.0. (not compatible with TOS 5.3.x)

How to test it

1) sorting of interfaces

Tested on Mox AC

before fix

/etc/config/networks

config device
	option name 'br-lan'
	option bridge_empty '1'
	list ports 'lan4'
	list ports 'lan2'
	list ports 'lan3'
	list ports 'lan1'
	option type 'bridge'
root@mox:/# python
Python 3.9.12 (main, May 11 2022, 12:08:08) 
>>> from pprint import pprint
>>> import turrishw
>>> pprint(turrishw.get_ifaces(), sort_dicts=False)
{'lan4': {'type': 'eth',
          'bus': 'eth',
          'state': 'up',
          'slot': 'LAN4',
          'module_id': 1,
          'macaddr': 'aa:bb:cc:11:22:33',
          'link_speed': 1000},
 'lan2': {'type': 'eth',
          'bus': 'eth',
          'state': 'down',
          'slot': 'LAN2',
          'module_id': 1,
          'macaddr': 'aa:bb:cc:11:22:33',
          'link_speed': 0},
 'lan3': {'type': 'eth',
          'bus': 'eth',
          'state': 'down',
          'slot': 'LAN3',
          'module_id': 1,
          'macaddr': 'aa:bb:cc:11:22:33',
          'link_speed': 0},
 'lan1': {'type': 'eth',
          'bus': 'eth',
          'state': 'down',
          'slot': 'LAN1',
          'module_id': 1,
          'macaddr': 'aa:bb:cc:11:22:33',
          'link_speed': 0},
 'eth0': {'type': 'eth',
          'bus': 'eth',
          'state': 'up',
          'slot': 'ETH0',
          'module_id': 0,
          'macaddr': 'aa:bb:cc:11:22:33',
          'link_speed': 1000}}

after fix

root@mox:/# python
Python 3.9.12 (main, May 11 2022, 12:08:08) 
>>> from pprint import pprint
>>> import turrishw
>>> pprint(turrishw.get_ifaces(), sort_dicts=False)
{'eth0': {'type': 'eth',
          'bus': 'eth',
          'state': 'up',
          'slot': 'ETH0',
          'module_id': 0,
          'macaddr': 'aa:bb:cc:11:22:33',
          'link_speed': 1000},
 'lan1': {'type': 'eth',
          'bus': 'eth',
          'state': 'down',
          'slot': 'LAN1',
          'module_id': 1,
          'macaddr': 'aa:bb:cc:11:22:33',
          'link_speed': 0},
 'lan2': {'type': 'eth',
          'bus': 'eth',
          'state': 'down',
          'slot': 'LAN2',
          'module_id': 1,
          'macaddr': 'aa:bb:cc:11:22:33',
          'link_speed': 0},
 'lan3': {'type': 'eth',
          'bus': 'eth',
          'state': 'down',
          'slot': 'LAN3',
          'module_id': 1,
          'macaddr': 'aa:bb:cc:11:22:33'',
          'link_speed': 0},
 'lan4': {'type': 'eth',
          'bus': 'eth',
          'state': 'up',
          'slot': 'LAN4',
          'module_id': 1,
          'macaddr': 'aa:bb:cc:11:22:33'',
          'link_speed': 1000}}

2) Turris 1.x detection on TOS 6.0

before fix

None interfaces are returned.

root@mox:/# python
Python 3.9.12 (main, May 11 2022, 12:08:08) 
>>> from pprint import pprint
>>> import turrishw
>>> pprint(turrishw.get_ifaces(), sort_dicts=False)
{}

after fix

Eth0, Lan and wlan0..1 interfaces (if used) should be returned.

Edited by Josef Schlehofer

Merge request reports