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

Small fixes. #41

Merged
merged 2 commits into from Oct 15, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 13 additions & 9 deletions hdmi2usb/modeswitch/boards.py
Expand Up @@ -125,8 +125,8 @@ def load_fx2(board, mode=None, filename=None, verbose=False):
try:
output = subprocess.check_output(cmdline, stderr=subprocess.STDOUT)
except subprocess.CalledProcessError as e:
if b"can't modify CPUCS: Protocol error\n" not in e.stdout:
print(e.stdout)
if b"can't modify CPUCS: Protocol error\n" not in e.output:
print(e.output)
raise


Expand Down Expand Up @@ -218,7 +218,7 @@ def flash_fpga(board, filename, verbose=False):
subprocess.check_call(cmdline)


def find_boards():
def find_boards(prefer_hardware_serial=True, verbose=False):
all_boards = []
exart_uarts = []
for device in usbapi.find_usb_devices():
Expand Down Expand Up @@ -251,6 +251,9 @@ def find_boards():
all_boards.append(
Board(dev=device, type="atlys", state="operational"))

elif device.vid == 0x04e2 and device.pid == 0x1410:
exart_uarts.append(device)

# Numato Opsis
# --------------------------
# The Numato Opsis will boot in the following mode when the EEPROM is
Expand Down Expand Up @@ -324,20 +327,21 @@ def find_boards():
# Patch the Atlys board so the exar_uart is associated with it.
if exart_uarts:
atlys_boards = [b for b in all_boards if b.type == "atlys"]
sys.stderr.write(
" Found exart-uarts at %s associating with Atlys at %s\n" %
(exart_uarts, atlys_boards))
if verbose:
sys.stderr.write(
" Found exart-uarts at %s associating with Atlys at %s\n" %
(exart_uarts, atlys_boards))
assert len(exart_uarts) == len(atlys_boards)
assert len(atlys_boards) == 1

def extra_tty(
uart=exart_uarts[0],
board=atlys_boards[0],
prefer=args.prefer_hardware_serial):
prefer=prefer_hardware_serial):
if prefer:
return uart.tty + board.dev.tty
return uart.tty() + board.dev.tty()
else:
return board.dev.tty + uart.tty
return board.dev.tty() + uart.tty()

atlys_boards[0].tty = extra_tty

Expand Down
2 changes: 1 addition & 1 deletion hdmi2usb/modeswitch/cli.py
Expand Up @@ -127,7 +127,7 @@ def args_parser(board, mode):


def find_boards(args):
all_boards = boards.find_boards()
all_boards = boards.find_boards(verbose=args.verbose)

# Filter out the boards we don't care about
filtered_boards = []
Expand Down