diff --git a/bitelab/__init__.py b/bitelab/__init__.py index 39c4892..fd3bca1 100644 --- a/bitelab/__init__.py +++ b/bitelab/__init__.py @@ -77,16 +77,19 @@ class SerialConsole(DefROAttribute): defattrname = 'console' async def activate(self, brd): - cmd = ('devfs', '-m', brd.attrs['devfspath'], 'rule', 'apply', - 'path', os.path.basename(self._value), 'unhide', ) - sub = await asyncio.create_subprocess_exec(*cmd, - stdin=subprocess.DEVNULL, stdout=subprocess.DEVNULL, - stderr=subprocess.DEVNULL) + devname = os.path.basename(self._value) + + for i in (devname, devname + '.*'): + cmd = ('devfs', '-m', brd.attrs['devfspath'], 'rule', + 'apply', 'path', i, 'unhide', ) + sub = await asyncio.create_subprocess_exec(*cmd, + stdin=subprocess.DEVNULL, stdout=subprocess.DEVNULL, + stderr=subprocess.DEVNULL) - ret = await sub.wait() + ret = await sub.wait() - if ret: - raise RuntimeError('activate failed: %d' % ret) + if ret: + raise RuntimeError('activate failed: %d' % ret) class BoardImpl: def __init__(self, name, brdclass, options): @@ -942,12 +945,18 @@ class TestAttrs(unittest.IsolatedAsyncioTestCase): await sc.activate(brd) - cse.assert_called_with('devfs', '-m', devfspath, 'rule', + cse.assert_any_call('devfs', '-m', devfspath, 'rule', 'apply', 'path', os.path.basename(await sc.getvalue()), 'unhide', stdin=subprocess.DEVNULL, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) + cse.assert_any_call('devfs', '-m', devfspath, 'rule', + 'apply', 'path', + os.path.basename(await sc.getvalue()) + '.*', 'unhide', + stdin=subprocess.DEVNULL, stdout=subprocess.DEVNULL, + stderr=subprocess.DEVNULL) + wrap_subprocess_exec(cse, retcode=1) with self.assertRaises(RuntimeError): await sc.activate(brd)