Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Glasgow does not gracefully shutdown if the device is unplugged... #386

Closed
attie opened this issue Aug 5, 2023 · 3 comments · Fixed by #452
Closed

Glasgow does not gracefully shutdown if the device is unplugged... #386

attie opened this issue Aug 5, 2023 · 3 comments · Fixed by #452
Assignees
Labels
software Component: software

Comments

@attie
Copy link
Member

attie commented Aug 5, 2023

For example, running the uart applet, and then unplugging it will produce lots of output, and then hang on E: g.cli: transfer error: LIBUSB_TRANSFER_ERROR, requiring ^C to return to the shell.

Console Output
user@c0f973ab2540:~$ glasgow run uart -V 3.3 tty
I: g.device.hardware: generating bitstream ID fc10eecac687e82738156c3ee7cdfb42
I: g.cli: running handler for applet 'uart'
I: g.applet.interface.uart: port(s) A, B voltage set to 3.3 V
I: g.applet.interface.uart: running on a TTY; enter `Ctrl+\ q` to quit
W: g.applet.interface.uart: 40 frame or parity errors detected
W: g.applet.interface.uart: 12201 frame or parity errors detected
W: g.applet.interface.uart: 12202 frame or parity errors detected
W: g.applet.interface.uart: 12214 frame or parity errors detected
W: g.applet.interface.uart: 12211 frame or parity errors detected
E: asyncio: Task exception was never retrieved
future: <Task finished name='Task-5' coro=<DirectDemultiplexerInterface._in_task() done, defined at /opt/glasgow/software/glasgow/access/direct/demultiplexer.py:214> exception=GlasgowDeviceError('transfer error:
 LIBUSB_TRANSFER_ERROR')>
Traceback (most recent call last):
  File "/opt/glasgow/software/glasgow/access/direct/demultiplexer.py", line 222, in _in_task
    data = await self.device.bulk_read(self._endpoint_in, size)
  File "/opt/glasgow/software/glasgow/device/hardware.py", line 287, in bulk_read
    data = await self._do_transfer(is_read=True, setup=lambda transfer:
  File "/opt/glasgow/software/glasgow/device/hardware.py", line 257, in _do_transfer
    return await result_future
glasgow.device.GlasgowDeviceError: transfer error: LIBUSB_TRANSFER_ERROR
E: asyncio: Task exception was never retrieved
future: <Task finished name='Task-6' coro=<DirectDemultiplexerInterface._in_task() done, defined at /opt/glasgow/software/glasgow/access/direct/demultiplexer.py:214> exception=GlasgowDeviceError('transfer error:
 LIBUSB_TRANSFER_ERROR')>
Traceback (most recent call last):
  File "/opt/glasgow/software/glasgow/access/direct/demultiplexer.py", line 222, in _in_task
    data = await self.device.bulk_read(self._endpoint_in, size)
  File "/opt/glasgow/software/glasgow/device/hardware.py", line 287, in bulk_read
    data = await self._do_transfer(is_read=True, setup=lambda transfer:
  File "/opt/glasgow/software/glasgow/device/hardware.py", line 257, in _do_transfer
    return await result_future
glasgow.device.GlasgowDeviceError: transfer error: LIBUSB_TRANSFER_ERROR
E: asyncio: Task exception was never retrieved
future: <Task finished name='Task-7' coro=<DirectDemultiplexerInterface._in_task() done, defined at /opt/glasgow/software/glasgow/access/direct/demultiplexer.py:214> exception=GlasgowDeviceError('transfer error:
 LIBUSB_TRANSFER_ERROR')>
Traceback (most recent call last):
  File "/opt/glasgow/software/glasgow/access/direct/demultiplexer.py", line 222, in _in_task
    data = await self.device.bulk_read(self._endpoint_in, size)
  File "/opt/glasgow/software/glasgow/device/hardware.py", line 287, in bulk_read
    data = await self._do_transfer(is_read=True, setup=lambda transfer:
  File "/opt/glasgow/software/glasgow/device/hardware.py", line 257, in _do_transfer
    return await result_future
glasgow.device.GlasgowDeviceError: transfer error: LIBUSB_TRANSFER_ERROR
E: asyncio: Task exception was never retrieved
future: <Task finished name='Task-8' coro=<DirectDemultiplexerInterface._in_task() done, defined at /opt/glasgow/software/glasgow/access/direct/demultiplexer.py:214> exception=GlasgowDeviceError('transfer error:
 LIBUSB_TRANSFER_ERROR')>
Traceback (most recent call last):
  File "/opt/glasgow/software/glasgow/access/direct/demultiplexer.py", line 222, in _in_task
    data = await self.device.bulk_read(self._endpoint_in, size)
  File "/opt/glasgow/software/glasgow/device/hardware.py", line 287, in bulk_read
    data = await self._do_transfer(is_read=True, setup=lambda transfer:
  File "/opt/glasgow/software/glasgow/device/hardware.py", line 257, in _do_transfer
    return await result_future
glasgow.device.GlasgowDeviceError: transfer error: LIBUSB_TRANSFER_ERROR
E: asyncio: Task exception was never retrieved
future: <Task finished name='Task-9' coro=<DirectDemultiplexerInterface._in_task() done, defined at /opt/glasgow/software/glasgow/access/direct/demultiplexer.py:214> exception=GlasgowDeviceError('transfer error:
 LIBUSB_TRANSFER_ERROR')>
Traceback (most recent call last):
  File "/opt/glasgow/software/glasgow/access/direct/demultiplexer.py", line 222, in _in_task
    data = await self.device.bulk_read(self._endpoint_in, size)
  File "/opt/glasgow/software/glasgow/device/hardware.py", line 287, in bulk_read
    data = await self._do_transfer(is_read=True, setup=lambda transfer:
  File "/opt/glasgow/software/glasgow/device/hardware.py", line 257, in _do_transfer
    return await result_future
glasgow.device.GlasgowDeviceError: transfer error: LIBUSB_TRANSFER_ERROR
E: asyncio: Task exception was never retrieved
future: <Task finished name='Task-10' coro=<DirectDemultiplexerInterface._in_task() done, defined at /opt/glasgow/software/glasgow/access/direct/demultiplexer.py:214> exception=GlasgowDeviceError('transfer error
: LIBUSB_TRANSFER_ERROR')>
Traceback (most recent call last):
  File "/opt/glasgow/software/glasgow/access/direct/demultiplexer.py", line 222, in _in_task
    data = await self.device.bulk_read(self._endpoint_in, size)
  File "/opt/glasgow/software/glasgow/device/hardware.py", line 287, in bulk_read
    data = await self._do_transfer(is_read=True, setup=lambda transfer:
  File "/opt/glasgow/software/glasgow/device/hardware.py", line 257, in _do_transfer
    return await result_future
glasgow.device.GlasgowDeviceError: transfer error: LIBUSB_TRANSFER_ERROR
E: asyncio: Task exception was never retrieved
future: <Task finished name='Task-11' coro=<DirectDemultiplexerInterface._in_task() done, defined at /opt/glasgow/software/glasgow/access/direct/demultiplexer.py:214> exception=GlasgowDeviceError('transfer error
: LIBUSB_TRANSFER_ERROR')>
Traceback (most recent call last):
  File "/opt/glasgow/software/glasgow/access/direct/demultiplexer.py", line 222, in _in_task
    data = await self.device.bulk_read(self._endpoint_in, size)
  File "/opt/glasgow/software/glasgow/device/hardware.py", line 287, in bulk_read
    data = await self._do_transfer(is_read=True, setup=lambda transfer:
  File "/opt/glasgow/software/glasgow/device/hardware.py", line 257, in _do_transfer
    return await result_future
glasgow.device.GlasgowDeviceError: transfer error: LIBUSB_TRANSFER_ERROR
E: asyncio: Task exception was never retrieved
future: <Task finished name='Task-12' coro=<DirectDemultiplexerInterface._in_task() done, defined at /opt/glasgow/software/glasgow/access/direct/demultiplexer.py:214> exception=GlasgowDeviceError('transfer error
: LIBUSB_TRANSFER_ERROR')>
Traceback (most recent call last):
  File "/opt/glasgow/software/glasgow/access/direct/demultiplexer.py", line 222, in _in_task
    data = await self.device.bulk_read(self._endpoint_in, size)
  File "/opt/glasgow/software/glasgow/device/hardware.py", line 287, in bulk_read
    data = await self._do_transfer(is_read=True, setup=lambda transfer:
  File "/opt/glasgow/software/glasgow/device/hardware.py", line 257, in _do_transfer
    return await result_future
glasgow.device.GlasgowDeviceError: transfer error: LIBUSB_TRANSFER_ERROR
E: asyncio: Task exception was never retrieved
future: <Task finished name='Task-13' coro=<DirectDemultiplexerInterface._in_task() done, defined at /opt/glasgow/software/glasgow/access/direct/demultiplexer.py:214> exception=GlasgowDeviceError('transfer error
: LIBUSB_TRANSFER_ERROR')>
Traceback (most recent call last):
  File "/opt/glasgow/software/glasgow/access/direct/demultiplexer.py", line 222, in _in_task
    data = await self.device.bulk_read(self._endpoint_in, size)
  File "/opt/glasgow/software/glasgow/device/hardware.py", line 287, in bulk_read
    data = await self._do_transfer(is_read=True, setup=lambda transfer:
  File "/opt/glasgow/software/glasgow/device/hardware.py", line 257, in _do_transfer
    return await result_future
glasgow.device.GlasgowDeviceError: transfer error: LIBUSB_TRANSFER_ERROR
E: g.cli: transfer error: LIBUSB_TRANSFER_ERROR
@whitequark whitequark added the software Component: software label Aug 5, 2023
@whitequark
Copy link
Member

Oh yeah. I've spent a lot of effort making it not do that and it's still an issue.

@whitequark
Copy link
Member

Fixed by #452.

@whitequark
Copy link
Member

requiring ^C to return to the shell.

The UART applet in TTY mode specifically still requires this, but it also works with a single newline. Other applets return instantly. This could be separately fixed in the UART applet.

@whitequark whitequark self-assigned this Oct 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
software Component: software
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants