Skip to content

Commit

Permalink
Fix the exart uart discovery for Atlys boards.
Browse files Browse the repository at this point in the history
  • Loading branch information
mithro committed Aug 16, 2016
1 parent 82a82c8 commit 7209306
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
18 changes: 11 additions & 7 deletions hdmi2usb/modeswitch/boards.py
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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

0 comments on commit 7209306

Please sign in to comment.