|
2 | 2 | import os |
3 | 3 | import signal |
4 | 4 | import logging |
5 | | -from coax import open_serial_interface, TerminalType |
| 5 | +from coax import open_serial_interface, TerminalType, Feature |
6 | 6 |
|
7 | 7 | from .args import parse_args |
8 | 8 | from .interface import InterfaceWrapper |
9 | 9 | from .controller import Controller |
10 | | -from .device import get_ids, get_features, get_keyboard_description, UnsupportedDeviceError |
11 | | -from .terminal import Terminal |
| 10 | +from .device import get_ids, get_features, UnsupportedDeviceError |
| 11 | +from .terminal import Terminal, get_model, get_keyboard_description |
12 | 12 | from .tn3270 import TN3270Session |
13 | 13 |
|
14 | 14 | # VT100 emulation is not supported on Windows. |
@@ -40,34 +40,35 @@ def _get_keymap(_args, keyboard_description): |
40 | 40 | return KEYMAP_3278_TYPEWRITER |
41 | 41 |
|
42 | 42 | def _create_device(args, interface, device_address, _poll_response): |
43 | | - # Read the terminal identifiers. |
44 | 43 | (terminal_id, extended_id) = get_ids(interface, device_address) |
45 | 44 |
|
46 | | - logger.info(f'Terminal ID = {terminal_id}') |
| 45 | + logger.info(f'Terminal ID = {terminal_id}, Extended ID = {extended_id}') |
47 | 46 |
|
48 | 47 | if terminal_id.type != TerminalType.CUT: |
49 | 48 | raise UnsupportedDeviceError('Only CUT type terminals are supported') |
50 | 49 |
|
51 | | - logger.info(f'Extended ID = {extended_id}') |
| 50 | + model = get_model(terminal_id, extended_id) |
52 | 51 |
|
53 | | - if extended_id is not None: |
54 | | - logger.info(f'Model = IBM {extended_id[2:6]} or equivalent') |
| 52 | + if model is not None: |
| 53 | + logger.info(f'Model = IBM {model} or equivalent') |
55 | 54 |
|
56 | | - keyboard_description = get_keyboard_description(terminal_id, extended_id) |
57 | | - |
58 | | - logger.info(f'Keyboard = {keyboard_description}') |
59 | | - |
60 | | - # Read the terminal features. |
61 | 55 | features = get_features(interface, device_address) |
62 | 56 |
|
| 57 | + # The 3179 includes an EAB but does not respond to the READ_FEATURE_ID |
| 58 | + # command. |
| 59 | + if model == '3179': |
| 60 | + features[Feature.EAB] = 7 |
| 61 | + |
63 | 62 | logger.info(f'Features = {features}') |
64 | 63 |
|
65 | | - # Get the keymap. |
| 64 | + keyboard_description = get_keyboard_description(terminal_id, extended_id) |
| 65 | + |
| 66 | + logger.info(f'Keyboard = {keyboard_description}') |
| 67 | + |
66 | 68 | keymap = _get_keymap(args, keyboard_description) |
67 | 69 |
|
68 | 70 | logger.info(f'Keymap = {keymap.name}') |
69 | 71 |
|
70 | | - # Create the terminal. |
71 | 72 | terminal = Terminal(interface, device_address, terminal_id, extended_id, features, keymap) |
72 | 73 |
|
73 | 74 | return terminal |
|
0 commit comments