Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: GlasgowEmbedded/glasgow
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 574986c3c116
Choose a base ref
...
head repository: GlasgowEmbedded/glasgow
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 169456e3cccf
Choose a head ref
  • 2 commits
  • 2 files changed
  • 1 contributor

Commits on Jul 28, 2020

  1. cli: fix path logging.

    whitequark committed Jul 28, 2020
    Copy the full SHA
    a6afac4 View commit details
  2. cli: use built-in Python 3.8 mechanism to handle Ctrl+C on Windows.

    The one in support.asignal never worked on Windows, anyway.
    whitequark committed Jul 28, 2020
    Copy the full SHA
    169456e View commit details
Showing with 5 additions and 15 deletions.
  1. +4 −2 software/glasgow/cli.py
  2. +1 −13 software/glasgow/support/asignal.py
6 changes: 4 additions & 2 deletions software/glasgow/cli.py
Original file line number Diff line number Diff line change
@@ -422,6 +422,9 @@ async def _main():
args = get_argparser().parse_args()
create_logger(args)

if sys.version_info < (3, 8) and os.name == "nt":
logger.warn("Ctrl-C on Windows is only supported on Python 3.8+")

device = None
try:
with importlib.resources.path(__package__, "firmware.ihex") as firmware_filename:
@@ -671,7 +674,7 @@ async def wait_for_sigint():
new_image = fx2_config.encode()
new_image[0] = 0xC0 # see below
else:
logger.info("using firmware from %r",
logger.info("using firmware from %s",
args.firmware.name if args.firmware else firmware_filename)
with (args.firmware or open(firmware_filename, "rb")) as f:
for (addr, chunk) in input_data(f, fmt="ihex"):
@@ -791,7 +794,6 @@ def startTest(test):

def main():
loop = asyncio.get_event_loop()
register_wakeup_fd(loop)
exit(loop.run_until_complete(_main()))


14 changes: 1 addition & 13 deletions software/glasgow/support/asignal.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,8 @@
import os
import signal
import asyncio


__all__ = ["register_wakeup_fd", "wait_for_signal"]


def register_wakeup_fd(loop):
read_fd, write_fd = os.pipe()
os.set_blocking(write_fd, False)
old_write_fd = signal.set_wakeup_fd(write_fd)
def chain_wakeup_fd():
sigdata = os.read(read_fd, 1)
if old_write_fd != -1:
os.write(old_write_fd, sigdata)
loop.add_reader(read_fd, chain_wakeup_fd)
__all__ = ["wait_for_signal"]


def wait_for_signal(signum, loop=None):