]>
Commit | Line | Data |
---|---|---|
fb249641 UH |
1 | ## |
2 | ## This file is part of the libsigrokdecode project. | |
3 | ## | |
4 | ## Copyright (C) 2018 Jorge Solla Rubiales <jorgesolla@gmail.com> | |
5 | ## | |
6 | ## This program is free software; you can redistribute it and/or modify | |
7 | ## it under the terms of the GNU General Public License as published by | |
8 | ## the Free Software Foundation; either version 2 of the License, or | |
9 | ## (at your option) any later version. | |
10 | ## | |
11 | ## This program is distributed in the hope that it will be useful, | |
12 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | ## GNU General Public License for more details. | |
15 | ## | |
16 | ## You should have received a copy of the GNU General Public License | |
17 | ## along with this program. If not, see <http://www.gnu.org/licenses/>. | |
18 | ## | |
19 | ||
20 | logical_adresses = [ | |
21 | 'TV', | |
22 | 'Recording_1', | |
23 | 'Recording_2', | |
24 | 'Tuner_1', | |
25 | 'Playback_1', | |
26 | 'AudioSystem', | |
27 | 'Tuner2', | |
28 | 'Tuner3', | |
29 | 'Playback_2', | |
30 | 'Recording_3', | |
31 | 'Tuner_4', | |
32 | 'Playback_3', | |
33 | 'Backup_1', | |
34 | 'Backup_2', | |
35 | 'FreeUse', | |
36 | ] | |
37 | ||
38 | # List taken from LibCEC. | |
39 | opcodes = { | |
40 | 0x82: 'ACTIVE_SOURCE', | |
41 | 0x04: 'IMAGE_VIEW_ON', | |
42 | 0x0D: 'TEXT_VIEW_ON', | |
43 | 0x9D: 'INACTIVE_SOURCE', | |
44 | 0x85: 'REQUEST_ACTIVE_SOURCE', | |
45 | 0x80: 'ROUTING_CHANGE', | |
46 | 0x81: 'ROUTING_INFORMATION', | |
47 | 0x86: 'SET_STREAM_PATH', | |
48 | 0x36: 'STANDBY', | |
49 | 0x0B: 'RECORD_OFF', | |
50 | 0x09: 'RECORD_ON', | |
51 | 0x0A: 'RECORD_STATUS', | |
52 | 0x0F: 'RECORD_TV_SCREEN', | |
53 | 0x33: 'CLEAR_ANALOGUE_TIMER', | |
54 | 0x99: 'CLEAR_DIGITAL_TIMER', | |
55 | 0xA1: 'CLEAR_EXTERNAL_TIMER', | |
56 | 0x34: 'SET_ANALOGUE_TIMER', | |
57 | 0x97: 'SET_DIGITAL_TIMER', | |
58 | 0xA2: 'SET_EXTERNAL_TIMER', | |
59 | 0x67: 'SET_TIMER_PROGRAM_TITLE', | |
60 | 0x43: 'TIMER_CLEARED_STATUS', | |
61 | 0x35: 'TIMER_STATUS', | |
62 | 0x9E: 'CEC_VERSION', | |
63 | 0x9F: 'GET_CEC_VERSION', | |
64 | 0x83: 'GIVE_PHYSICAL_ADDRESS', | |
65 | 0x91: 'GET_MENU_LANGUAGE', | |
66 | 0x84: 'REPORT_PHYSICAL_ADDRESS', | |
67 | 0x32: 'SET_MENU_LANGUAGE', | |
68 | 0x42: 'DECK_CONTROL', | |
69 | 0x1B: 'DECK_STATUS', | |
70 | 0x1A: 'GIVE_DECK_STATUS', | |
71 | 0x41: 'PLAY', | |
72 | 0x08: 'GIVE_TUNER_DEVICE_STATUS', | |
73 | 0x92: 'SELECT_ANALOGUE_SERVICE', | |
74 | 0x93: 'SELECT_DIGITAL_SERVICE', | |
75 | 0x07: 'TUNER_DEVICE_STATUS', | |
76 | 0x06: 'TUNER_STEP_DECREMENT', | |
77 | 0x05: 'TUNER_STEP_INCREMENT', | |
78 | 0x87: 'DEVICE_VENDOR_ID', | |
79 | 0x8C: 'GIVE_DEVICE_VENDOR_ID', | |
80 | 0x89: 'VENDOR_COMMAND', | |
81 | 0xA0: 'VENDOR_COMMAND_WITH_ID', | |
82 | 0x8A: 'VENDOR_REMOTE_BUTTON_DOWN', | |
83 | 0x8B: 'VENDOR_REMOTE_BUTTON_UP', | |
84 | 0x64: 'SET_OSD_STRING', | |
85 | 0x46: 'GIVE_OSD_NAME', | |
86 | 0x47: 'SET_OSD_NAME', | |
87 | 0x8D: 'MENU_REQUEST', | |
88 | 0x8E: 'MENU_STATUS', | |
89 | 0x44: 'USER_CONTROL_PRESSED', | |
90 | 0x45: 'USER_CONTROL_RELEASE', | |
91 | 0x8F: 'GIVE_DEVICE_POWER_STATUS', | |
92 | 0x90: 'REPORT_POWER_STATUS', | |
93 | 0x00: 'FEATURE_ABORT', | |
94 | 0xFF: 'ABORT', | |
95 | 0x71: 'GIVE_AUDIO_STATUS', | |
96 | 0x7D: 'GIVE_SYSTEM_AUDIO_MODE_STATUS', | |
97 | 0x7A: 'REPORT_AUDIO_STATUS', | |
98 | 0x72: 'SET_SYSTEM_AUDIO_MODE', | |
99 | 0x70: 'SYSTEM_AUDIO_MODE_REQUEST', | |
100 | 0x7E: 'SYSTEM_AUDIO_MODE_STATUS', | |
101 | 0x9A: 'SET_AUDIO_RATE', | |
102 | } | |
103 | ||
3f5f3a92 UH |
104 | def resolve_logical_address(id_, is_initiator): |
105 | if id_ < 0 or id_ > 0x0F: | |
fb249641 UH |
106 | return 'Invalid' |
107 | ||
108 | # Special handling of 0x0F. | |
3f5f3a92 | 109 | if id_ == 0x0F: |
fb249641 UH |
110 | return 'Unregistered' if is_initiator else 'Broadcast' |
111 | ||
3f5f3a92 | 112 | return logical_adresses[id_] |
fb249641 UH |
113 | |
114 | def decode_header(header): | |
115 | src = (header & 0xF0) >> 4 | |
116 | dst = (header & 0x0F) | |
117 | return (resolve_logical_address(src, 1), resolve_logical_address(dst, 0)) |