aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan <fauxpark@gmail.com>2020-06-05 20:56:03 +1000
committerJames Young <18669334+noroadsleft@users.noreply.github.com>2020-08-29 14:30:02 -0700
commit5cc3ab38c9148cd6bc7ccdba176a88fbb95653b1 (patch)
treedd076eba2a41b566c1e84b899dcb97e9c459fdba
parent3dbbd4cf4466ba36676e028ce78c60bf7ccc4282 (diff)
downloadqmk_firmware-5cc3ab38c9148cd6bc7ccdba176a88fbb95653b1.tar.gz
qmk_firmware-5cc3ab38c9148cd6bc7ccdba176a88fbb95653b1.zip
Remove iWRAP protocol (#9284)
-rw-r--r--doxygen-todo1
-rw-r--r--tmk_core/protocol/iwrap.mk32
-rw-r--r--tmk_core/protocol/iwrap/iWRAP4.txt376
-rw-r--r--tmk_core/protocol/iwrap/iWRAP5.txt356
-rw-r--r--tmk_core/protocol/iwrap/iwrap.c420
-rw-r--r--tmk_core/protocol/iwrap/iwrap.h47
-rw-r--r--tmk_core/protocol/iwrap/main.c412
-rw-r--r--tmk_core/protocol/iwrap/mux_exit.rb7
-rw-r--r--tmk_core/protocol/iwrap/suart.S156
-rw-r--r--tmk_core/protocol/iwrap/suart.h8
-rw-r--r--tmk_core/protocol/iwrap/wd.h161
-rw-r--r--tmk_core/readme.md5
12 files changed, 2 insertions, 1979 deletions
diff --git a/doxygen-todo b/doxygen-todo
index 39fb498d9..d8892e48d 100644
--- a/doxygen-todo
+++ b/doxygen-todo
@@ -1,6 +1,5 @@
1tmk_core/protocol 1tmk_core/protocol
2tmk_core/protocol/chibios 2tmk_core/protocol/chibios
3tmk_core/protocol/iwrap
4tmk_core/protocol/lufa 3tmk_core/protocol/lufa
5tmk_core/protocol/midi 4tmk_core/protocol/midi
6tmk_core/protocol/midi/bytequeue 5tmk_core/protocol/midi/bytequeue
diff --git a/tmk_core/protocol/iwrap.mk b/tmk_core/protocol/iwrap.mk
deleted file mode 100644
index 934235bd8..000000000
--- a/tmk_core/protocol/iwrap.mk
+++ /dev/null
@@ -1,32 +0,0 @@
1IWRAP_DIR = protocol/iwrap
2
3OPT_DEFS += -DPROTOCOL_IWRAP
4
5SRC += $(IWRAP_DIR)/main.c \
6 $(IWRAP_DIR)/iwrap.c \
7 $(IWRAP_DIR)/suart.S \
8 $(COMMON_DIR)/sendchar_uart.c \
9 $(COMMON_DIR)/uart.c
10
11# Search Path
12VPATH += $(TMK_DIR)/protocol/iwrap
13
14
15# TODO: compatible with LUFA and PJRC
16# V-USB
17#
18VUSB_DIR = protocol/vusb
19
20# Path to the V-USB library
21VUSB_PATH = $(LIB_PATH)/vusb
22
23SRC += $(VUSB_DIR)/vusb.c \
24 $(VUSB_PATH)/usbdrv/usbdrv.c \
25 $(VUSB_PATH)/usbdrv/usbdrvasm.S \
26 $(VUSB_PATH)/usbdrv/oddebug.c
27
28# Search Path
29VPATH += $(TMK_PATH)/$(VUSB_DIR)
30VPATH += $(VUSB_PATH)
31
32OPT_DEFS += -DPROTOCOL_VUSB
diff --git a/tmk_core/protocol/iwrap/iWRAP4.txt b/tmk_core/protocol/iwrap/iWRAP4.txt
deleted file mode 100644
index 2a062d9d9..000000000
--- a/tmk_core/protocol/iwrap/iWRAP4.txt
+++ /dev/null
@@ -1,376 +0,0 @@
1Bulegiga WT12
2=============
3WT12 is a bluetooth module from Bluegiga. http://www.bluegiga.com/
4
5iWRAP
6 higher layer interface for bluetooth firmware
7 communicate with UART
8
9iWRAP HID
10default setting
11 115200 8bit/n/1/n
12
13
14TODO
15----
16KiCAD circuit/PCB design
17power saving
18 AVR sleep(15ms by watch dog timer)
19 WT12 sleep
20 measuring current consumption
21 measuring battery life of normal usage/idle/intensive usage
22software reset/bootloarder
23LED indicator(chaging/paring/connecting)
24license confirmation of suart.c
25consumer page is not working
26authenticate method/SSP
27SPP keyboard support
28SPP debug console support
29mouse wheel feature request to Bluegiga
30
31
32Problems
33--------
34power consumption
35no consumer page support(bug?)
36no mouse wheel support
37no paring management
38no interactive auth method
39
40
41UART hardware flow control
42--------------------------
43(iWRAP4 User Guide 9.5)
44Hardware flow control is enabled by default and it should not be disabled unless mandatory, because without the hardware flow control the data transmission may not be reliable.
45If the hardware flow control is enabled from PS-keys, but no flow control is used, the following steps should be implemented in the hardware design:
46- CTS pin must be grounded
47- RTS pin must be left floating
48
49
50Power Saving
51------------
52power consume
53 without opimization: 4hr to shutdown(310mAh)
54 2011/08/25: 9hr(310mAh) SNIFF MASTER sleep/WDTO_120MS
55
56measure current consumption
57 HHKB keyswitch matrix board
58 idle
59 scanning
60 Bluegiga WT12 module
61 SLEEP command
62 deep sleep on/off in config bits
63
64HHKB keyswich
65 how to power off
66 I/O pin configuration when sleeping
67 FET switch for 5V regulator
68
69Bluetooth module
70 power off when in USB mode
71 power off by FET switch
72
73AVR configuration
74 unused pins
75 ADC
76
77
78
79SET CONTROL CONFIG
80------------------
81 SET CONTROL CONFIG 4810
82 SET CONTROL CONFIG LIST
83 SET CONTROL CONFIG 0000 0000 4910 DEEP_SLEEP KLUDGE INTERACTIVE_PIN UART_LATENCY
84
85 Bit14 UART low latency
86 Bit11 Interactive pairing mode
87 Bit04 Deep sleep
88
89
90Reconnection
91------------
92SET CONTROL AUTOCALL 1124 5000 HID
93 1124 HID service class
94 5000 interval ms
95
96HID profile
97-----------
98This is needed to configure only once.
99 SET PROFILE HID ON
100 RESET
101
102HID class
103---------
104 SET BT CLASS 005C0 // keyboard/mouse combined devie
105
106Pairing Security
107----------------
108Secure Simple Pairing(SSP)
109 SET BT SSP 2 0 // Enables SSP for keyboard and Man-in-the-middle protection
110 SET BT SSP 3 0 // Enables SSP just works mode
111
112for keyboard with SSP
113 SET BT AUTH * 0000
114 SET BT SSP 2 0
115 SET CONTROL CONFIG 800
116 RESET
117
118for keyboard without SSP
119 SET BT AUTH * 0000
120 SET CONTROL CONFIG 800
121 RESET
122
123AUTH
124 AUTH xx:xx:xx:xx:xx:xx? // Pairing request event
125 AUTH xx:xx:xx:xx:xx:xx 0000
126
127 SSP PASSKEY 78:dd:08:b7:e4:a2 ?
128 SSP PASSKEY 78:dd:08:b7:e4:a2 xxxxx
129 (SSP COMPLETE 78:dd:08:b7:e4:a2 HCI_ERROR_AUTH_FAIL // failed)
130 RING 0 78:dd:08:b7:e4:a2 11 HID
131
132Connecton
133 RING xx:xx:xx:xx:xx:xx xx HID // connection event
134
135 KILL xx:xx:xx:xx:xx:xx
136
137Mode
138----
139Command mode
140Data mode
141 Raw mode
142 (Simple mode not for a real keyboard)
143
144Raw mode
145 Keyboard:
146 0x9f, length(10), 0xa1, 0x01, mods, 0x00, key1, key2, key3, key4, key5, key6
147
148 Mouse:
149 0x9f, length(5), 0xa1, 0x02, buttons, X, Y
150
151 Consumer page:
152 0x9f, length(5), 0xa1, 0x03, bitfield1, bitfield2, bitfield3
153
154 consumer page suage
155 Bitfield 1:
156 0x01 Volume Increment
157 0x02 Volume Decrement
158 0x04 Mute
159 0x08 Play/Pause
160 0x10 Scan Next Track
161 0x20 Scan Previous Track
162 0x40 Stop
163 0x80 Eject
164 Bitfield 2:
165 0x01 Email Reader
166 0x02 Application Control Search
167 0x04 AC Bookmarks
168 0x08 AC Home
169 0x10 AC Back
170 0x20 AC Forward
171 0x40 AC Stop
172 0x80 AC Refresh
173 Bitfield 3:
174 0x01 Application Launch Generic Consumer Control
175 0x02 AL Internet Browser
176 0x04 AL Calculator
177 0x08 AL Terminal Lock / Screensaver
178 0x10 AL Local Machine Browser
179 0x20 AC Minimize
180 0x40 Record
181 0x80 Rewind
182
183
184
185
186
1872011/07/13
188set
189SET BT BDADDR 00:07:80:47:22:14
190SET BT NAME HHKB pro BT
191SET BT CLASS 0005c0
192SET BT AUTH * 0000
193SET BT IDENT BT:47 f000 4.1.0 Bluegiga iWRAP
194SET BT LAP 9e8b33
195SET BT PAGEMODE 4 2000 1
196SET BT PAIR 78:dd:08:b7:e4:a2 a191189cd7e51030ad6a07848ce879bb
197SET BT POWER 3 3 3
198SET BT ROLE 0 f 7d00
199SET BT SNIFF 0 20 1 8
200SET BT SSP 2 1
201SET BT MTU 667
202SET CONTROL AUTOCALL 1124 3000 HID
203SET CONTROL BAUD 38400,8n1
204SET CONTROL CD 00 0
205SET CONTROL ECHO 7
206SET CONTROL ESCAPE 43 00 1
207SET CONTROL GAIN 0 5
208SET CONTROL INIT SET CONTROL MUX 0
209SET CONTROL MSC DTE 00 00 00 00 00 00
210SET CONTROL MUX 1
211SET CONTROL PIO 00 00
212SET CONTROL READY 00
213SET PROFILE HID f HID
214SET
215
216info config
217
218!!! THIS IS BETA RELEASE AND MAY BE USED FOR EVALUATION PURPOSES ONLY !!!
219
220WRAP THOR AI (4.1.0 build 435)
221Copyright (c) 2003-2011 Bluegiga Technologies Inc.
222Compiled on Jun 28 2011 17:19:51, running on WT12-A module, psr v31
223 AVRCP BGIO FTP HFP HFP_AG HID HID_CONSUMER_PAGE HSP LEDS MAP OTA PBAP PIO=0x00fc SSP SUBRATE TEST VOLUME
224 - BOCK3 version 435 (Jun 28 2011 17:19:37) (max acl/sco 7/1)
225 - Bluetooth version 2.1, Power class 2
226 - Loader 4279, firmware 6297 (56-bit encryption), native execution mode
227 - up 0 days, 06:23, 2 connections (pool 2)
228 - User configuration:
229&028a = 0001 0000 0000 0011 0024 0000 0000 0010 0000 0080 0000 0000 0080 005f 009b 0034 00fb 0006
230&028b = 0000 0bb8
231&028d = 0001
232&0295 = 0000 0005 000b 0000 0003 0000 0000 0000 0000 0000 0000
233&0298 = a006
234&0299 = 0000 0000
235&02a3 = 0030 0030 0030 0030
236&02a4 = 009d 0000
237&02a5 = 0053 0045 0054 0020 0043 004f 004e 0054 0052 004f 004c 0020 004d 0055 0058 0020 0030
238&02a7 = 0000 05c0
239&02a8 = 4910 0000 0000
240&02aa = 0004 2000 0001 0033 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
241&02ac = 0000 0000 002b 0000 0000 0000 0000 0000 0000 0000 0002 0000 0000 0000 0010 0000 0000 0000 0000 029b 0000 0000 0000 0000
242&02ad = 4848 424b 7020 6f72 4220 0054
243&02b3 = 0005 0003 0003 0003 0003 0003 0003 0003 0003 0003 0003 0003 0003 0003 0003 0003
244&02b7 = 000f 4948 0044
245&02bb = 8000
246READY.
247
248
249
250
2512011/07/07 settings:
252set
253SET BT BDADDR 00:07:80:47:22:14
254SET BT NAME HHKB Pro BT
255SET BT CLASS 0005c0
256SET BT AUTH * 000
257SET BT IDENT BT:47 f000 4.0.0 Bluegiga iWRAP
258SET BT LAP 9e8b33
259SET BT PAGEMODE 4 2000 1
260SET BT PAIR 78:dd:08:b7:e4:a2 9e54d0aabb1b4d73cfccddb1ea4ef2d6
261SET BT POWER 3 3 3
262SET BT ROLE 0 f 7d00
263SET BT SNIFF 0 20 1 8
264SET BT SSP 3 0
265SET BT MTU 667
266SET CONTROL BAUD 38400,8n1
267SET CONTROL CD 00 0
268SET CONTROL ECHO 7
269SET CONTROL ESCAPE 255 00 1
270SET CONTROL GAIN 0 5
271SET CONTROL INIT set control mux 0
272SET CONTROL MSC DTE 00 00 00 00 00 00
273SET CONTROL PREAMP 1 1
274SET CONTROL READY 00
275SET PROFILE HID HID
276SET PROFILE SPP Bluetooth Serial Port
277SET
278
279info config
280WRAP THOR AI (4.0.0 build 317)
281Copyright (c) 2003-2010 Bluegiga Technologies Inc.
282Compiled on Apr 20 2010 16:44:28, running on WT12-A module, psr v31
283 AVRCP FTP PBAP PIO=0x00fc SSP SUBRATE VOLUME
284 - BOCK3 version 317 (Apr 20 2010 16:44:21) (max acl/sco 7/1)
285 - Bluetooth version 2.1, Power class 2
286 - Loader 4279, firmware 6297 (56-bit encryption), native execution mode
287 - up 0 days, 00:00, 0 connections (pool 1)
288 - User configuration:
289&028c = 0001 0020 0000 0001 0008 0000
290&028d = 0000
291&0296 = 0047 0001 f000 0400 6c42 6575 6967 6167 6920 5257 5041
292&0298 = c006
293&02a3 = 0030 0030 0030
294&02a4 = 009d 0000
295&02a5 = 0073 0065 0074 0020 0063 006f 006e 0074 0072 006f 006c 0020 006d 0075 0078 0020 0030
296&02a7 = 0000 05c0
297&02a8 = 0800 0000 0000
298&02ac = 0000 0000 00ff 0000 0000 0000 0000 0000 0000 0000 0002 0000 0000 0000 0010 0000 0000 0000 0000 029b 0000 0000 0000 0000
299&02ad = 4848 424b 5020 6f72 4220 0054
300&02b3 = 0004 0003 0003 0003 0003 0003 0003 0003 0003 0003 0003 0003 0003 0003 0003 0003
301&02b7 = 0000
302&02bb = 6c42 6575 6f74 746f 2068 6553 6972 6c61 5020 726f 0074
303READY.
304
305
306
3072011/08/23:
308SET BT BDADDR 00:07:80:47:22:14
309SET BT NAME HHKB pro BT
310SET BT CLASS 0005c0
311SET BT AUTH * 0000
312SET BT IDENT BT:47 f000 4.1.0 Bluegiga iWRAP
313SET BT LAP 9e8b33
314SET BT PAGEMODE 4 2000 1
315SET BT PAIRCOUNT 4
316SET BT POWER 3 3 3
317SET BT ROLE 1 f 12c0
318SET BT SNIFF 10 2 1 8
319SET BT SSP 3 0
320SET BT MTU 667
321SET CONTROL BAUD 38400,8n1
322SET CONTROL CD 00 0
323SET CONTROL ECHO 7
324SET CONTROL ESCAPE 43 00 1
325SET CONTROL GAIN 0 5
326SET CONTROL INIT SET CONTROL MUX 0
327SET CONTROL MSC DTE 00 00 00 00 00 00
328SET CONTROL MUX 1
329SET CONTROL PIO 00 00
330SET CONTROL READY 00
331SET PROFILE HID 7 HIDKeyboardMouse
332SET
333
334SET CONTROL CONFIG 0000 0004 481e CLOCK_CACHE INTERLACED_INQ INTERLACED_PAGE DEEP_SLEEP INTERACTIVE_PIN UART_LATENCY 23D_NOKLUDGE
335
336
337
3382011/08/25:
339SET BT BDADDR 00:07:80:47:22:14
340SET BT NAME HHKB pro BT
341SET BT CLASS 0005c0
342
343SET BT IDENT BT:47 f000 4.1.0 Bluegiga iWRAP
344SET BT LAP 9e8b33
345SET BT PAGEMODE 4 2000 1
346SET BT PAIRCOUNT 4
347SET BT PAIR 78:dd:08:b7:e4:a2 0be83335a03fed8ededae42e99554e28
348SET BT POWER 3 3 3
349SET BT ROLE 1 f 12c0
350SET BT SNIFF 100 20 1 8
351SET BT SSP 3 0
352SET BT MTU 667
353SET CONTROL BAUD 38400,8n1
354SET CONTROL CD 00 0
355SET CONTROL ECHO 7
356SET CONTROL ESCAPE - 20 1
357SET CONTROL GAIN 0 5
358SET CONTROL INIT SET CONTROL MUX 0
359SET CONTROL MSC DTE 00 00 00 00 00 00
360SET CONTROL MUX 1
361SET CONTROL PIO 00 00
362SET CONTROL READY 00
363SET PROFILE HID f HIDKeyboardMouse
364SET
365
366
367SET CONTROL CONFIG 0000 0000 490e CLOCK_CACHE INTERLACED_INQ INTERLACED_PAGE KLUDGE INTERACTIVE_PIN UART_LATENCY
368
369
3702011/09/08:
371SET CONTROL CONFIG 0000 0000 410e CLOCK_CACHE INTERLACED_INQ INTERLACED_PAGE KLUDGE UART_LATENCY
372
373 Removed INTERACTIVE_PIN to avoid interactive auth and use SET BT AUTH pin(0000).
374
375
376EOF
diff --git a/tmk_core/protocol/iwrap/iWRAP5.txt b/tmk_core/protocol/iwrap/iWRAP5.txt
deleted file mode 100644
index ce3310f1b..000000000
--- a/tmk_core/protocol/iwrap/iWRAP5.txt
+++ /dev/null
@@ -1,356 +0,0 @@
1Terminology
2===========
3PSM
4HIDP HID Protocol
5L2CAP Logical Link Control Adaptation Protocol
6MTU Maximum Transmission Unit
7
8
9
10HID Protocol
11============
123 of HID_SPEC_V11.pdf
13
14Channel
15-------
16Control channel PSM=0x0011
17Interrupt channel PSM=0x0013
18
19Message
20-------
21HANDSHAKE(0)
22HID_CONTROL(1)
23
24GET_REPORT(4)
25 Host requests report(DATA payload on Control channel) from Device
26 Size Desc
27 ------------------------------------------------------------------------------
28 HIDP-Hdr 1 7..4: HIDP Message TYpe(4: GET_REPORT)
29 3: Size(1:2-octed buffer size, 0:size of the report)
30 2: 0
31 1..0: Report Type(1:input, 2:output, 3: feature)
32 ReportID 1 Optional
33 BufferSize 2 Optional(specified when Size=1)
34
35SET_REPORT(5)
36GET_PROTOCOL(6)
37SET_PROTOCOL(7)
38
39DATA(A)
40 Input/Output Report: All DATA payloads flow on Interrupt channel.
41 Other: flows on Control channel.
42 Size Desc
43 ------------------------------------------------------------------------------
44 HIDP-Hdr 1 7..4 0xA
45 3..2 Reserved(0)
46 1..0 Report Type(0:Other, 1:Input, 2:Output, 3:Feature)
47 Payload N Data
48
49
50
51
52Boot Protocol
53=============
543.3.2
55No report descriptor, fixed report descriptors defined.
56
57Device ReportID Size
58---------------------------------
59Reserved 0
60Keyboard 1 9octets
61Mouse 2 4octets
62Reserved 3-255
63
64Report descriptor
65-----------------
66Report ID is added to USB HID boot protocol descriptor.
67Boot Protocol device doesn't need to supply descriptors. and can send extra data on end of boot report this data will be ignored unless host supports report descriptor.
68
69Report Protocol devices can have specific descriptors. Using Boot protocol descriptor followed by extra data may be useful for compatibility to Boot protocol only supported host.
70
71NOTE:
72Bluegiga HID sample say report ID of mouse is 1 but 2?
73Bluegiga HID sample say report ID of consumer page is 2 but 3?
74** mouse.desc and consumer.desc were fixed.
75 size
76keyboard.desc 67 0x43
77mouse.desc 60 0x3c
78consumer.desc 82 0x52
79combo.desc 209 0xd1
80
81
82
83SDP
84===
85attributes(3.3.2)
86----------
87HIDDeviceSubclass
88 which type is supported in Boot Protocol Mode
89 7 6
90 ---
91 0 1 Keyboard
92 1 0 Pointing device
93 1 1 Combo keyboard/pointing device
94
95HIDBootDevice
96 TRUE
97HIDReconnectInitiate
98 TRUE
99
100
101Class of Device/Service
102=======================
103http://phys.sci.hokudai.ac.jp/LABS/yts/pic/GB002/Bluetooth_assigned_numbers_baseband.pdf
104
1050x0005C0 Keyboard and Pointing deivce(combo)
106
107
108 23 16 15 8 7 0
109 ---------------------------------
110 Service |Major |Minor |Format
111
112 Format type
113 1 0
114 ---
115 0 0
116
117 Minor Device Class of Peripheral Major
118 7 6
119 ---
120 0 1 Keyboard
121 1 0 Pointing device
122 1 1 Combo keyboard/pointing device
123
124
125 Major device classes
126 12 11 10 9 8
127 --------------
128 0 0 0 0 0 Miscellaneous
129 0 0 0 0 1 Computer
130 0 0 0 1 0 Phone
131 0 0 0 1 1 LAN /Network Access point
132 0 0 1 0 0 Audio/Video (headset,speaker,stereo, video display, vcr.....
133 0 0 1 0 1 *Peripheral (mouse, joystick, keyboards, ..... )
134 0 0 1 1 0 Imaging (printing, scanner, camera, display, ...)
135 1 1 1 1 1 Uncategorized, specific device code not specified
136 X X X X X All other values reserved
137
138
139 Major service classes
140 bit
141 --------------------------------------
142 13 Limited Discoverable Mode [Ref #1]
143 14 (reserved)
144 15 (reserved)
145 16 Positioning (Location identification)
146 17 Networking (LAN, Ad hoc, ...)
147 18 Rendering (Printing, Speaker, ...)
148 19 Capturing (Scanner, Microphone, ...)
149 20 Object Transfer (v-Inbox, v-Folder, ...)
150 21 Audio (Speaker, Microphone, Headset service, ...)
151 22 Telephony (Cordless telephony, Modem, Headset service, ...)
152 23 Information (WEB-server, WAP-server, ...)
153
154
155
156
157Authentication SSP
158-------------------
159SET BT SSP 2 0 PASS KEY entering
160SET BT SSP 3 0 NO PASS KEY entering
161SET BT SSP <capabilities> <mitm>
162 <capabilities>: 0:display only 1:display+yes/no button 2:keyboard only 3:none
163SET BT SSP 2 1 # 2:keyboard only 1:Man-in-the-middle protection is needed
164SET BT SSP 2 0 # 2:keyboard only 0:Man-in-the-middle protection is not needed
165
166
167SET BT SSP 2 1
168 bond only if MITM protection is supported by host
169SET BT SSP 2 0
170 bond even if MITM protection is not supported by host
171
172On Windows 'Add device' causes SSP PASSKEY event on iWRAP
173 SSP PASSKEY 78:dd:08:b7:e4:a2 ?
174
175If device has display(0 or 1) this event occurs. User should be shown this code on the device.
176 SSP CONFIRM 78:dd:08:b7:e4:a2 517572
177
178
179SET BT SSP 3 0
180 No input/output, No MITM protection.
181 Without procedure of authentication the divice is bond to host.
182
183
184Connect
185=======
186CALL 78:dd:08:b7:e4:a2 11 HID
187
188
189Setting
190========
191Following settings need to be done before wiring into keyboard.
192- UART speed: 38400bps(115200bps didn't work with software serial)
193- No SSP procedure(without MITM protection)
194- No Power Saving
195
196# clear pairing record and set default
197SET BT PAIR *
198SET RESET
199
200SET CONTROL INIT SET CONTROL MUX 0
201SET CONTROL BAUD 38400,8n1
202SET BT NAME TMK Blootooth WT12
203SET BT CLASS 0005c0
204SET BT AUTH * 0000
205SET BT SSP 3 0
206SET CONTROL CONFIG 4800
207SET PROFILE HID 0f c0 0100 00 en 0409 TMK Bluetooth keyboard(WT12)
208SET PROFILE SPP
209
210# power saving?
211SET BT SNIFF 100 20 1 8
212
213
214# Report Descriptor
215# combo keyboard + mouse + consumer
216HID SET d2 05010906a1010507850119e029e715002501750195088102950175088101950575010508850119012905910295017503910395067508150025650507190029658100c005010902a1010901a1008502050919012908150025017501950881020501093009311581257f750895028106093895018106050c0a380295018106c0c0050c0901a1018503050c1500250109e909ea09e209cd19b529b87501950881020a8a010a21020a2a021a23022a27027501950881020a83010a96010a92010a9e010a94010a060209b209b4750195088102c0
217
218
219
220SET PROFILE HID
221---------------
222 SET PROFILE HID 0d c0 100 0 en 0409 HHKB pro Bluetooth keyboard
223 {function bit} uint8
224 {subclass} uint8
225 {version} uint16
226 {country} uint8
227 {BTlang} char[2]
228 {USBlang} uint16
229 {name} string
230
231
232SET BT CLASS
233------------
234 See Class of Device
235 composite device: keyboard and mouse
236 SET BT CLASS 005c0
237
238
239
240
241
242
243----------
244after setting
245----------
246set
247SET BT BDADDR 00:07:80:47:22:14
248SET BT NAME TMK Blootooth WT12
249SET BT CLASS 0005c0
250SET BT AUTH * 0000
251SET BT IDENT BT:47 f000 5.0.1 Bluegiga iWRAP
252SET BT LAP 9e8b33
253SET BT PAGEMODE 4 2000 1
254SET BT PAIR 78:dd:08:b7:e4:a2 9e3d85c91bcae73fef8cc10bec18b42f
255SET BT POWER 3 3 3
256SET BT ROLE 0 f 7d00
257SET BT SNIFF 0 20 1 8
258SET BT SSP 3 0
259SET BT MTU 667
260SET CONTROL BAUD 38400,8n1
261SET CONTROL CD 00 0
262SET CONTROL ECHO 7
263SET CONTROL ESCAPE 43 00 1
264SET CONTROL GAIN 0 5
265SET CONTROL INIT SET CONTROL MUX 0
266SET CONTROL MSC DTE 00 00 00 00 00 00
267SET CONTROL MUX 1
268SET CONTROL PIO 00 00
269SET CONTROL READY 00
270SET PROFILE HID 0f c0 0100 00 en 0409 TMK Bluetooth keyboard(WT12)
271SET
272
273set control config list
274SET CONTROL CONFIG 0000 0000 0000 4900 KLUDGE INTERACTIVE_PIN UART_LATENCY
275
276
277info config
278WRAP THOR AI (5.0.1 build 620)
279Copyright (c) 2003-2012 Bluegiga Technologies Inc.
280Compiled on Oct 1 2012 10:56:21, running on WT12-A module, psr v31
281 BGIO FTP HFP HFP_AG HID HID_CONSUMER_PAGE HSP MAP MDP OTA PBAP PIO=0x00fc SSP SUBRATE TEST VOLUME
282 - BOCK4 version 620 (Oct 1 2012 10:56:03) (max acl/sco 7/1)
283 - Bluetooth version 3.0, Power class 2
284 - Loader 8615, firmware 8825 (56-bit encryption), native execution mode
285 - up 0 days, 01:50, 2 connections (pool 2)
286 - User configuration:
287&028d = 0001
288&0295 = 0000 0005 000b 0000 0003 0000 0000 0000 0000 0000 0000
289&0298 = c053
290&0299 = 0000 0000
291&02a3 = 0030 0030 0030 0030
292&02a4 = 009d 0000
293&02a5 = 0053 0045 0054 0020 0043 004f 004e 0054 0052 004f 004c 0020 004d 0055 0058 0020 0030
294&02a7 = 0000 05c0
295&02a8 = 0800 0000 0000 0000
296&02aa = 0004 2000 0001 0033 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
297&02ac = 0000 0000 002b 0000 0000 0000 0000 0000 0000 0000 0002 0000 0000 0000 0010 0000 0000 0000 0000 029b 0000 0000 0000 0000
298&02ad = 4d54 204b 6c42 6f6f 6f74 746f 2068 5457 3231
299&02b0 = fa65 b0aa 934a 077b a600 d1cc fe58 8dd5
300&02b3 = 0004 0003 0003 0003 0003 0003 0003 0003 0003 0003 0003 0003 0003 0003 0003 0003 0005 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0005
301&02b7 = 000f 00c0 0100 0000 0065 006e 0409 4d54 204b 6c42 6575 6f74 746f &02bb = 8000
302READY.
303----------
304
305
306
307-----
308After 5.0.1 Firmware update
309Firmware: ai-5.0.1-620-25b.bc4.dfu
310PSR: wt12-a.ai-5.0.1-620-25b.psrf
311-----
312info config
313WRAP THOR AI (5.0.1 build 620)
314Copyright (c) 2003-2012 Bluegiga Technologies Inc.
315Compiled on Oct 1 2012 10:56:21, running on WT12-A module, psr v31
316 BGIO FTP HFP HFP_AG HID HID_CONSUMER_PAGE HSP MAP MDP OTA PBAP PIO=0x00fc SSP SUBRATE TEST VOLUME
317 - BOCK4 version 620 (Oct 1 2012 10:56:03) (max acl/sco 7/1)
318 - Bluetooth version 3.0, Power class 2
319 - Loader 8615, firmware 8825 (56-bit encryption), native execution mode
320 - up 0 days, 00:03, 0 connections (pool 1)
321 - User configuration:
322&0295 = 0000 0005 000b 0000 0003 0000 0000 0000 0000 0000 0000
323&0299 = 0000 0000
324&02aa = 0004 2000 0001 0033 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
325&02ac = 0000 0000 002b 0000 0000 0000 0000 0000 0000 0000 0002 0000 0000 0000 0010 0000 0000 0000 0000 029b 0000 0000 0000 0000
326&02ad = 5457 3231 412d
327&02b0 = fa65 b0aa 934a 077b a600 d1cc fe58 8dd5
328READY.
329
330set
331SET BT BDADDR 00:07:80:47:22:14
332SET BT NAME WT12-A
333SET BT CLASS 001f00
334SET BT IDENT BT:47 f000 5.0.1 Bluegiga iWRAP
335SET BT LAP 9e8b33
336SET BT PAGEMODE 4 2000 1
337SET BT PAIR 78:dd:08:b7:e4:a2 af18f81faa107e6dd068762ef921f48b
338SET BT POWER 3 3 3
339SET BT ROLE 0 f 7d00
340SET BT SNIFF 0 20 1 8
341SET BT SSP 3 0
342SET BT MTU 667
343SET CONTROL BAUD 115200,8n1
344SET CONTROL CD 00 0
345SET CONTROL ECHO 7
346SET CONTROL ESCAPE 43 00 1
347SET CONTROL GAIN 0 5
348SET CONTROL MSC DTE 00 00 00 00 00 00
349SET CONTROL PIO 00 00
350SET CONTROL READY 00
351SET PROFILE SPP Bluetooth Serial Port
352SET
353
354set control config list
355SET CONTROL CONFIG 0000 0000 0000 0100 KLUDGE
356---------
diff --git a/tmk_core/protocol/iwrap/iwrap.c b/tmk_core/protocol/iwrap/iwrap.c
deleted file mode 100644
index 4d0ca5756..000000000
--- a/tmk_core/protocol/iwrap/iwrap.c
+++ /dev/null
@@ -1,420 +0,0 @@
1/*
2Copyright 2011 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18/* host driver for Bulegiga iWRAP */
19/* Bluegiga BT12
20 * Connections
21 * Hardware UART Software UART BlueTooth
22 * PC=====UART=======AVR=====SUART====iWRAP(BT12)-----------PC
23 *
24 * - Hardware UART for Debug Console to communicate iWRAP
25 * - Software UART for iWRAP control to send keyboard/mouse data
26 */
27
28#include <stdint.h>
29#include <string.h>
30#include <avr/interrupt.h>
31#include <util/delay.h>
32#include "keycode.h"
33#include "suart.h"
34#include "uart.h"
35#include "report.h"
36#include "host_driver.h"
37#include "iwrap.h"
38#include "print.h"
39
40/* iWRAP MUX mode utils. 3.10 HID raw mode(iWRAP_HID_Application_Note.pdf) */
41#define MUX_HEADER(LINK, LENGTH) \
42 do { \
43 xmit(0xbf); /* SOF */ \
44 xmit(LINK); /* Link */ \
45 xmit(0x00); /* Flags */ \
46 xmit(LENGTH); /* Length */ \
47 } while (0)
48#define MUX_FOOTER(LINK) xmit(LINK ^ 0xff)
49
50static uint8_t connected = 0;
51// static uint8_t channel = 1;
52
53/* iWRAP buffer */
54#define MUX_BUF_SIZE 64
55static char buf[MUX_BUF_SIZE];
56static uint8_t snd_pos = 0;
57
58#define MUX_RCV_BUF_SIZE 256
59static char rcv_buf[MUX_RCV_BUF_SIZE];
60static uint8_t rcv_head = 0;
61static uint8_t rcv_tail = 0;
62
63/* receive buffer */
64static void rcv_enq(char c) {
65 uint8_t next = (rcv_head + 1) % MUX_RCV_BUF_SIZE;
66 if (next != rcv_tail) {
67 rcv_buf[rcv_head] = c;
68 rcv_head = next;
69 }
70}
71
72static char rcv_deq(void) {
73 char c = 0;
74 if (rcv_head != rcv_tail) {
75 c = rcv_buf[rcv_tail++];
76 rcv_tail %= MUX_RCV_BUF_SIZE;
77 }
78 return c;
79}
80
81/*
82static char rcv_peek(void)
83{
84 if (rcv_head == rcv_tail)
85 return 0;
86 return rcv_buf[rcv_tail];
87}
88*/
89
90static void rcv_clear(void) { rcv_tail = rcv_head = 0; }
91
92/* iWRAP response */
93ISR(PCINT1_vect, ISR_BLOCK) // recv() runs away in case of ISR_NOBLOCK
94{
95 if ((SUART_IN_PIN & (1 << SUART_IN_BIT))) return;
96
97 static volatile uint8_t mux_state = 0xff;
98 static volatile uint8_t mux_link = 0xff;
99 uint8_t c = recv();
100 switch (mux_state) {
101 case 0xff: // SOF
102 if (c == 0xbf) mux_state--;
103 break;
104 case 0xfe: // Link
105 mux_state--;
106 mux_link = c;
107 break;
108 case 0xfd: // Flags
109 mux_state--;
110 break;
111 case 0xfc: // Length
112 mux_state = c;
113 break;
114 case 0x00:
115 mux_state = 0xff;
116 mux_link = 0xff;
117 break;
118 default:
119 if (mux_state--) {
120 uart_putchar(c);
121 rcv_enq(c);
122 }
123 }
124}
125
126/*------------------------------------------------------------------*
127 * iWRAP communication
128 *------------------------------------------------------------------*/
129void iwrap_init(void) {
130 // reset iWRAP if in already MUX mode after AVR software-reset
131 iwrap_send("RESET");
132 iwrap_mux_send("RESET");
133 _delay_ms(3000);
134 iwrap_send("\r\nSET CONTROL MUX 1\r\n");
135 _delay_ms(500);
136 iwrap_check_connection();
137}
138
139void iwrap_mux_send(const char *s) {
140 rcv_clear();
141 MUX_HEADER(0xff, strlen((char *)s));
142 iwrap_send(s);
143 MUX_FOOTER(0xff);
144}
145
146void iwrap_send(const char *s) {
147 while (*s) xmit(*s++);
148}
149
150/* send buffer */
151void iwrap_buf_add(uint8_t c) {
152 // need space for '\0'
153 if (snd_pos < MUX_BUF_SIZE - 1) buf[snd_pos++] = c;
154}
155
156void iwrap_buf_del(void) {
157 if (snd_pos) snd_pos--;
158}
159
160void iwrap_buf_send(void) {
161 buf[snd_pos] = '\0';
162 snd_pos = 0;
163 iwrap_mux_send(buf);
164}
165
166void iwrap_call(void) {
167 char *p;
168
169 iwrap_mux_send("SET BT PAIR");
170 _delay_ms(500);
171
172 p = rcv_buf + rcv_tail;
173 while (!strncmp(p, "SET BT PAIR", 11)) {
174 p += 7;
175 strncpy(p, "CALL", 4);
176 strncpy(p + 22, " 11 HID\n\0", 9);
177 print_S(p);
178 iwrap_mux_send(p);
179 // TODO: skip to next line
180 p += 57;
181
182 DEBUG_LED_CONFIG;
183 DEBUG_LED_ON;
184 _delay_ms(500);
185 DEBUG_LED_OFF;
186 _delay_ms(500);
187 DEBUG_LED_ON;
188 _delay_ms(500);
189 DEBUG_LED_OFF;
190 _delay_ms(500);
191 DEBUG_LED_ON;
192 _delay_ms(500);
193 DEBUG_LED_OFF;
194 _delay_ms(500);
195 DEBUG_LED_ON;
196 _delay_ms(500);
197 DEBUG_LED_OFF;
198 _delay_ms(500);
199 DEBUG_LED_ON;
200 _delay_ms(500);
201 DEBUG_LED_OFF;
202 _delay_ms(500);
203 }
204 iwrap_check_connection();
205}
206
207void iwrap_kill(void) {
208 char c;
209 iwrap_mux_send("LIST");
210 _delay_ms(500);
211
212 while ((c = rcv_deq()) && c != '\n')
213 ;
214 if (strncmp(rcv_buf + rcv_tail, "LIST ", 5)) {
215 print("no connection to kill.\n");
216 return;
217 }
218 // skip 10 'space' chars
219 for (uint8_t i = 10; i; i--)
220 while ((c = rcv_deq()) && c != ' ')
221 ;
222
223 char *p = rcv_buf + rcv_tail - 5;
224 strncpy(p, "KILL ", 5);
225 strncpy(p + 22, "\n\0", 2);
226 print_S(p);
227 iwrap_mux_send(p);
228 _delay_ms(500);
229
230 iwrap_check_connection();
231}
232
233void iwrap_unpair(void) {
234 iwrap_mux_send("SET BT PAIR");
235 _delay_ms(500);
236
237 char *p = rcv_buf + rcv_tail;
238 if (!strncmp(p, "SET BT PAIR", 11)) {
239 strncpy(p + 29, "\n\0", 2);
240 print_S(p);
241 iwrap_mux_send(p);
242 }
243}
244
245void iwrap_sleep(void) { iwrap_mux_send("SLEEP"); }
246
247void iwrap_sniff(void) {}
248
249void iwrap_subrate(void) {}
250
251bool iwrap_failed(void) {
252 if (strncmp(rcv_buf, "SYNTAX ERROR", 12))
253 return true;
254 else
255 return false;
256}
257
258uint8_t iwrap_connected(void) { return connected; }
259
260uint8_t iwrap_check_connection(void) {
261 iwrap_mux_send("LIST");
262 _delay_ms(100);
263
264 if (strncmp(rcv_buf, "LIST ", 5) || !strncmp(rcv_buf, "LIST 0", 6))
265 connected = 0;
266 else
267 connected = 1;
268 return connected;
269}
270
271/*------------------------------------------------------------------*
272 * Host driver
273 *------------------------------------------------------------------*/
274static uint8_t keyboard_leds(void);
275static void send_keyboard(report_keyboard_t *report);
276static void send_mouse(report_mouse_t *report);
277static void send_system(uint16_t data);
278static void send_consumer(uint16_t data);
279
280static host_driver_t driver = {keyboard_leds, send_keyboard, send_mouse, send_system, send_consumer};
281
282host_driver_t *iwrap_driver(void) { return &driver; }
283
284static uint8_t keyboard_leds(void) { return 0; }
285
286static void send_keyboard(report_keyboard_t *report) {
287 if (!iwrap_connected() && !iwrap_check_connection()) return;
288 MUX_HEADER(0x01, 0x0c);
289 // HID raw mode header
290 xmit(0x9f);
291 xmit(0x0a); // Length
292 xmit(0xa1); // DATA(Input)
293 xmit(0x01); // Report ID
294 xmit(report->mods);
295 xmit(0x00); // reserved byte(always 0)
296 xmit(report->keys[0]);
297 xmit(report->keys[1]);
298 xmit(report->keys[2]);
299 xmit(report->keys[3]);
300 xmit(report->keys[4]);
301 xmit(report->keys[5]);
302 MUX_FOOTER(0x01);
303}
304
305static void send_mouse(report_mouse_t *report) {
306#if defined(MOUSEKEY_ENABLE) || defined(PS2_MOUSE_ENABLE) || defined(POINTING_DEVICE_ENABLE)
307 if (!iwrap_connected() && !iwrap_check_connection()) return;
308 MUX_HEADER(0x01, 0x09);
309 // HID raw mode header
310 xmit(0x9f);
311 xmit(0x07); // Length
312 xmit(0xa1); // DATA(Input)
313 xmit(0x02); // Report ID
314 xmit(report->buttons);
315 xmit(report->x);
316 xmit(report->y);
317 xmit(report->v);
318 xmit(report->h);
319 MUX_FOOTER(0x01);
320#endif
321}
322
323static void send_system(uint16_t data) { /* not supported */
324}
325
326static void send_consumer(uint16_t data) {
327#ifdef EXTRAKEY_ENABLE
328 static uint16_t last_data = 0;
329 uint8_t bits1 = 0;
330 uint8_t bits2 = 0;
331 uint8_t bits3 = 0;
332
333 if (!iwrap_connected() && !iwrap_check_connection()) return;
334 if (data == last_data) return;
335 last_data = data;
336
337 // 3.10 HID raw mode(iWRAP_HID_Application_Note.pdf)
338 switch (data) {
339 case AUDIO_VOL_UP:
340 bits1 = 0x01;
341 break;
342 case AUDIO_VOL_DOWN:
343 bits1 = 0x02;
344 break;
345 case AUDIO_MUTE:
346 bits1 = 0x04;
347 break;
348 case TRANSPORT_PLAY_PAUSE:
349 bits1 = 0x08;
350 break;
351 case TRANSPORT_NEXT_TRACK:
352 bits1 = 0x10;
353 break;
354 case TRANSPORT_PREV_TRACK:
355 bits1 = 0x20;
356 break;
357 case TRANSPORT_STOP:
358 bits1 = 0x40;
359 break;
360 case TRANSPORT_EJECT:
361 bits1 = 0x80;
362 break;
363 case AL_EMAIL:
364 bits2 = 0x01;
365 break;
366 case AC_SEARCH:
367 bits2 = 0x02;
368 break;
369 case AC_BOOKMARKS:
370 bits2 = 0x04;
371 break;
372 case AC_HOME:
373 bits2 = 0x08;
374 break;
375 case AC_BACK:
376 bits2 = 0x10;
377 break;
378 case AC_FORWARD:
379 bits2 = 0x20;
380 break;
381 case AC_STOP:
382 bits2 = 0x40;
383 break;
384 case AC_REFRESH:
385 bits2 = 0x80;
386 break;
387 case AL_CC_CONFIG:
388 bits3 = 0x01;
389 break;
390 case AL_CALCULATOR:
391 bits3 = 0x04;
392 break;
393 case AL_LOCK:
394 bits3 = 0x08;
395 break;
396 case AL_LOCAL_BROWSER:
397 bits3 = 0x10;
398 break;
399 case AC_MINIMIZE:
400 bits3 = 0x20;
401 break;
402 case TRANSPORT_RECORD:
403 bits3 = 0x40;
404 break;
405 case TRANSPORT_REWIND:
406 bits3 = 0x80;
407 break;
408 }
409
410 MUX_HEADER(0x01, 0x07);
411 xmit(0x9f);
412 xmit(0x05); // Length
413 xmit(0xa1); // DATA(Input)
414 xmit(0x03); // Report ID
415 xmit(bits1);
416 xmit(bits2);
417 xmit(bits3);
418 MUX_FOOTER(0x01);
419#endif
420}
diff --git a/tmk_core/protocol/iwrap/iwrap.h b/tmk_core/protocol/iwrap/iwrap.h
deleted file mode 100644
index 51f2b5670..000000000
--- a/tmk_core/protocol/iwrap/iwrap.h
+++ /dev/null
@@ -1,47 +0,0 @@
1/*
2Copyright 2011 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#ifndef IWRAP_H
19#define IWRAP_H
20
21#include <stdint.h>
22#include <stdbool.h>
23#include "host_driver.h"
24
25/* enable iWRAP MUX mode */
26#define MUX_MODE
27
28host_driver_t *iwrap_driver(void);
29
30void iwrap_init(void);
31void iwrap_send(const char *s);
32void iwrap_mux_send(const char *s);
33void iwrap_buf_send(void);
34void iwrap_buf_add(uint8_t c);
35void iwrap_buf_del(void);
36
37void iwrap_call(void);
38void iwrap_kill(void);
39void iwrap_unpair(void);
40void iwrap_sleep(void);
41void iwrap_sniff(void);
42void iwrap_subrate(void);
43bool iwrap_failed(void);
44uint8_t iwrap_connected(void);
45uint8_t iwrap_check_connection(void);
46
47#endif
diff --git a/tmk_core/protocol/iwrap/main.c b/tmk_core/protocol/iwrap/main.c
deleted file mode 100644
index 4048a9791..000000000
--- a/tmk_core/protocol/iwrap/main.c
+++ /dev/null
@@ -1,412 +0,0 @@
1/*
2Copyright 2011 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17#include <stdint.h>
18#include <avr/interrupt.h>
19#include <avr/io.h>
20//#include <avr/wdt.h>
21#include "wd.h" // in order to use watchdog in interrupt mode
22#include <avr/sleep.h>
23#include <util/delay.h>
24#include <avr/power.h>
25#include "keyboard.h"
26#include "matrix.h"
27#include "host.h"
28#include "action.h"
29#include "iwrap.h"
30#ifdef PROTOCOL_VUSB
31# include "vusb.h"
32# include <usbdrv/usbdrv.h>
33#endif
34#include "uart.h"
35#include "suart.h"
36#include "timer.h"
37#include "debug.h"
38#include "keycode.h"
39#include "command.h"
40
41static void sleep(uint8_t term);
42static bool console(void);
43static bool console_command(uint8_t c);
44static uint8_t key2asc(uint8_t key);
45
46/*
47static void set_prr(void)
48{
49 power_adc_disable();
50 power_spi_disable();
51 power_twi_disable();
52#ifndef TIMER_H
53 //power_timer0_disable(); // used in timer.c
54#endif
55 power_timer1_disable();
56 power_timer2_disable();
57}
58*/
59
60/*
61static void pullup_pins(void)
62{
63 // DDRs are set to 0(input) by default.
64#ifdef PORTA
65 PORTA = 0xFF;
66#endif
67 PORTB = 0xFF;
68 PORTC = 0xFF;
69 PORTD = 0xFF;
70#ifdef PORTE
71 PORTE = 0xFF;
72#endif
73#ifdef PORTE
74 PORTF = 0xFF;
75#endif
76}
77*/
78
79#ifdef PROTOCOL_VUSB
80static void disable_vusb(void) {
81 // disable interrupt & disconnect to prevent host from enumerating
82 USB_INTR_ENABLE &= ~(1 << USB_INTR_ENABLE_BIT);
83 usbDeviceDisconnect();
84}
85
86static void enable_vusb(void) {
87 USB_INTR_ENABLE |= (1 << USB_INTR_ENABLE_BIT);
88 usbDeviceConnect();
89}
90
91static void init_vusb(void) {
92 uint8_t i = 0;
93
94 usbInit();
95 disable_vusb();
96 /* fake USB disconnect for > 250 ms */
97 while (--i) {
98 _delay_ms(1);
99 }
100 enable_vusb();
101}
102#endif
103
104void change_driver(host_driver_t *driver) {
105 /*
106 host_clear_keyboard_report();
107 host_swap_keyboard_report();
108 host_clear_keyboard_report();
109 host_send_keyboard_report();
110 */
111 clear_keyboard();
112 _delay_ms(1000);
113 host_set_driver(driver);
114}
115
116static bool sleeping = false;
117static bool insomniac = false; // TODO: should be false for power saving
118static uint16_t last_timer = 0;
119
120int main(void) {
121 MCUSR = 0;
122 clock_prescale_set(clock_div_1);
123 WD_SET(WD_OFF);
124
125 // power saving: the result is worse than nothing... why?
126 // pullup_pins();
127 // set_prr();
128
129#ifdef PROTOCOL_VUSB
130 disable_vusb();
131#endif
132 uart_init(115200);
133 keyboard_init();
134 print("\nSend BREAK for UART Console Commands.\n");
135
136 // TODO: move to iWRAP/suart file
137 print("suart init\n");
138 // suart init
139 // PC4: Tx Output IDLE(Hi)
140 PORTC |= (1 << 4);
141 DDRC |= (1 << 4);
142 // PC5: Rx Input(pull-up)
143 PORTC |= (1 << 5);
144 DDRC &= ~(1 << 5);
145 // suart receive interrut(PC5/PCINT13)
146 PCMSK1 = 0b00100000;
147 PCICR = 0b00000010;
148
149 host_set_driver(iwrap_driver());
150
151 print("iwrap_init()\n");
152 iwrap_init();
153 iwrap_call();
154
155 last_timer = timer_read();
156 while (true) {
157#ifdef PROTOCOL_VUSB
158 if (host_get_driver() == vusb_driver()) usbPoll();
159#endif
160 keyboard_task();
161#ifdef PROTOCOL_VUSB
162 if (host_get_driver() == vusb_driver()) vusb_transfer_keyboard();
163#endif
164 // TODO: depricated
165 if (matrix_is_modified() || console()) {
166 last_timer = timer_read();
167 sleeping = false;
168 } else if (!sleeping && timer_elapsed(last_timer) > 4000) {
169 sleeping = true;
170 iwrap_check_connection();
171 }
172
173 // TODO: suspend.h
174 if (host_get_driver() == iwrap_driver()) {
175 if (sleeping && !insomniac) {
176 _delay_ms(1); // wait for UART to send
177 iwrap_sleep();
178 sleep(WDTO_60MS);
179 }
180 }
181 }
182}
183
184static void sleep(uint8_t term) {
185 WD_SET(WD_IRQ, term);
186
187 cli();
188 set_sleep_mode(SLEEP_MODE_PWR_DOWN);
189 sleep_enable();
190 sleep_bod_disable();
191 sei();
192 sleep_cpu();
193 sleep_disable();
194
195 WD_SET(WD_OFF);
196}
197
198static bool console(void) {
199 // Send to Bluetoot module WT12
200 static bool breaked = false;
201 if (!uart_available())
202 return false;
203 else {
204 uint8_t c;
205 c = uart_getchar();
206 uart_putchar(c);
207 switch (c) {
208 case 0x00: // BREAK signal
209 if (!breaked) {
210 print("break(? for help): ");
211 breaked = true;
212 }
213 break;
214 case '\r':
215 uart_putchar('\n');
216 iwrap_buf_send();
217 break;
218 case '\b':
219 iwrap_buf_del();
220 break;
221 default:
222 if (breaked) {
223 print("\n");
224 console_command(c);
225 breaked = false;
226 } else {
227 iwrap_buf_add(c);
228 }
229 break;
230 }
231 return true;
232 }
233}
234
235bool command_extra(uint8_t code) { return console_command(key2asc(code)); }
236
237static bool console_command(uint8_t c) {
238 switch (c) {
239 case 'h':
240 case '?':
241 print("\nCommands for Bluetooth(WT12/iWRAP):\n");
242 print("r: reset. software reset by watchdog\n");
243 print("i: insomniac. prevent KB from sleeping\n");
244 print("c: iwrap_call. CALL for BT connection.\n");
245#ifdef PROTOCOL_VUSB
246 print("u: USB mode. switch to USB.\n");
247 print("w: BT mode. switch to Bluetooth.\n");
248#endif
249 print("k: kill first connection.\n");
250 print("Del: unpair first pairing.\n");
251 print("\n");
252 return 0;
253 case 'r':
254 print("reset\n");
255 WD_AVR_RESET();
256 return 1;
257 case 'i':
258 insomniac = !insomniac;
259 if (insomniac)
260 print("insomniac\n");
261 else
262 print("not insomniac\n");
263 return 1;
264 case 'c':
265 print("iwrap_call()\n");
266 iwrap_call();
267 return 1;
268#ifdef PROTOCOL_VUSB
269 case 'u':
270 print("USB mode\n");
271 init_vusb();
272 change_driver(vusb_driver());
273 // iwrap_kill();
274 // iwrap_sleep();
275 // disable suart receive interrut(PC5/PCINT13)
276 PCMSK1 &= ~(0b00100000);
277 PCICR &= ~(0b00000010);
278 return 1;
279 case 'w':
280 print("iWRAP mode\n");
281 change_driver(iwrap_driver());
282 disable_vusb();
283 // enable suart receive interrut(PC5/PCINT13)
284 PCMSK1 |= 0b00100000;
285 PCICR |= 0b00000010;
286 return 1;
287#endif
288 case 'k':
289 print("kill\n");
290 iwrap_kill();
291 return 1;
292 case 0x7F: // DELETE
293 print("unpair\n");
294 iwrap_unpair();
295 return 1;
296 }
297 return 0;
298}
299
300// convert keycode into ascii charactor
301static uint8_t key2asc(uint8_t key) {
302 switch (key) {
303 case KC_A:
304 return 'a';
305 case KC_B:
306 return 'b';
307 case KC_C:
308 return 'c';
309 case KC_D:
310 return 'd';
311 case KC_E:
312 return 'e';
313 case KC_F:
314 return 'f';
315 case KC_G:
316 return 'g';
317 case KC_H:
318 return 'h';
319 case KC_I:
320 return 'i';
321 case KC_J:
322 return 'j';
323 case KC_K:
324 return 'k';
325 case KC_L:
326 return 'l';
327 case KC_M:
328 return 'm';
329 case KC_N:
330 return 'n';
331 case KC_O:
332 return 'o';
333 case KC_P:
334 return 'p';
335 case KC_Q:
336 return 'q';
337 case KC_R:
338 return 'r';
339 case KC_S:
340 return 's';
341 case KC_T:
342 return 't';
343 case KC_U:
344 return 'u';
345 case KC_V:
346 return 'v';
347 case KC_W:
348 return 'w';
349 case KC_X:
350 return 'x';
351 case KC_Y:
352 return 'y';
353 case KC_Z:
354 return 'z';
355 case KC_1:
356 return '1';
357 case KC_2:
358 return '2';
359 case KC_3:
360 return '3';
361 case KC_4:
362 return '4';
363 case KC_5:
364 return '5';
365 case KC_6:
366 return '6';
367 case KC_7:
368 return '7';
369 case KC_8:
370 return '8';
371 case KC_9:
372 return '9';
373 case KC_0:
374 return '0';
375 case KC_ENTER:
376 return '\n';
377 case KC_ESCAPE:
378 return 0x1B;
379 case KC_BSPACE:
380 return '\b';
381 case KC_TAB:
382 return '\t';
383 case KC_SPACE:
384 return ' ';
385 case KC_MINUS:
386 return '-';
387 case KC_EQUAL:
388 return '=';
389 case KC_LBRACKET:
390 return '[';
391 case KC_RBRACKET:
392 return ']';
393 case KC_BSLASH:
394 return '\\';
395 case KC_NONUS_HASH:
396 return '#';
397 case KC_SCOLON:
398 return ';';
399 case KC_QUOTE:
400 return '\'';
401 case KC_GRAVE:
402 return '`';
403 case KC_COMMA:
404 return ',';
405 case KC_DOT:
406 return '.';
407 case KC_SLASH:
408 return '/';
409 default:
410 return 0x00;
411 }
412}
diff --git a/tmk_core/protocol/iwrap/mux_exit.rb b/tmk_core/protocol/iwrap/mux_exit.rb
deleted file mode 100644
index 1f6be48af..000000000
--- a/tmk_core/protocol/iwrap/mux_exit.rb
+++ /dev/null
@@ -1,7 +0,0 @@
1#
2# Rescue from Bluegiga iWRAP MUX mode
3# 6.75 of iWRAP5_User_Guid.pdf
4#
5[0xBF, 0xFF, 0x00, 0x11, 0x53, 0x45, 0x54, 0x20, 0x43, 0x4f, 0x4e, 0x54, 0x52, 0x4f, 0x4c, 0x20, 0x4d, 0x55, 0x58, 0x20, 0x30, 0x00].each do |x|
6 print x.chr
7end
diff --git a/tmk_core/protocol/iwrap/suart.S b/tmk_core/protocol/iwrap/suart.S
deleted file mode 100644
index a873515e1..000000000
--- a/tmk_core/protocol/iwrap/suart.S
+++ /dev/null
@@ -1,156 +0,0 @@
1;---------------------------------------------------------------------------;
2; Software implemented UART module ;
3; (C)ChaN, 2005 (http://elm-chan.org/) ;
4;---------------------------------------------------------------------------;
5; Bit rate settings:
6;
7; 1MHz 2MHz 4MHz 6MHz 8MHz 10MHz 12MHz 16MHz 20MHz
8; 2.4kbps 138 - - - - - - - -
9; 4.8kbps 68 138 - - - - - - -
10; 9.6kbps 33 68 138 208 - - - - -
11; 19.2kbps - 33 68 102 138 173 208 - -
12; 38.4kbps - - 33 50 68 85 102 138 172
13; 57.6kbps - - 21 33 44 56 68 91 114
14; 115.2kbps - - - - 21 27 33 44 56
15
16.nolist
17#include <avr/io.h>
18.list
19
20#define BPS 102 /* Bit delay. (see above table) */
21#define BIDIR 0 /* 0:Separated Tx/Rx, 1:Shared Tx/Rx */
22
23#define OUT_1 sbi _SFR_IO_ADDR(SUART_OUT_PORT), SUART_OUT_BIT /* Output 1 */
24#define OUT_0 cbi _SFR_IO_ADDR(SUART_OUT_PORT), SUART_OUT_BIT /* Output 0 */
25#define SKIP_IN_1 sbis _SFR_IO_ADDR(SUART_IN_PIN), SUART_IN_BIT /* Skip if 1 */
26#define SKIP_IN_0 sbic _SFR_IO_ADDR(SUART_IN_PIN), SUART_IN_BIT /* Skip if 0 */
27
28
29
30#ifdef SPM_PAGESIZE
31.macro _LPMI reg
32 lpm \reg, Z+
33.endm
34.macro _MOVW dh,dl, sh,sl
35 movw \dl, \sl
36.endm
37#else
38.macro _LPMI reg
39 lpm
40 mov \reg, r0
41 adiw ZL, 1
42.endm
43.macro _MOVW dh,dl, sh,sl
44 mov \dl, \sl
45 mov \dh, \sh
46.endm
47#endif
48
49
50
51;---------------------------------------------------------------------------;
52; Transmit a byte in serial format of N81
53;
54;Prototype: void xmit (uint8_t data);
55;Size: 16 words
56
57.global xmit
58.func xmit
59xmit:
60#if BIDIR
61 ldi r23, BPS-1 ;Pre-idle time for bidirectional data line
625: dec r23 ;
63 brne 5b ;/
64#endif
65 in r0, _SFR_IO_ADDR(SREG) ;Save flags
66
67 com r24 ;C = start bit
68 ldi r25, 10 ;Bit counter
69 cli ;Start critical section
70
711: ldi r23, BPS-1 ;----- Bit transferring loop
722: dec r23 ;Wait for a bit time
73 brne 2b ;/
74 brcs 3f ;MISO = bit to be sent
75 OUT_1 ;
763: brcc 4f ;
77 OUT_0 ;/
784: lsr r24 ;Get next bit into C
79 dec r25 ;All bits sent?
80 brne 1b ; no, coutinue
81
82 out _SFR_IO_ADDR(SREG), r0 ;End of critical section
83 ret
84.endfunc
85
86
87
88;---------------------------------------------------------------------------;
89; Receive a byte
90;
91;Prototype: uint8_t rcvr (void);
92;Size: 19 words
93
94.global rcvr
95.func rcvr
96rcvr:
97 in r0, _SFR_IO_ADDR(SREG) ;Save flags
98
99 ldi r24, 0x80 ;Receiving shift reg
100 cli ;Start critical section
101
1021: SKIP_IN_1 ;Wait for idle
103 rjmp 1b
1042: SKIP_IN_0 ;Wait for start bit
105 rjmp 2b
106 ldi r25, BPS/2 ;Wait for half bit time
1073: dec r25
108 brne 3b
109
1104: ldi r25, BPS ;----- Bit receiving loop
1115: dec r25 ;Wait for a bit time
112 brne 5b ;/
113 lsr r24 ;Next bit
114 SKIP_IN_0 ;Get a data bit into r24.7
115 ori r24, 0x80
116 brcc 4b ;All bits received? no, continue
117
118 out _SFR_IO_ADDR(SREG), r0 ;End of critical section
119 ret
120.endfunc
121
122
123; Not wait for start bit. This should be called after detecting start bit.
124.global recv
125.func recv
126recv:
127 in r0, _SFR_IO_ADDR(SREG) ;Save flags
128
129 ldi r24, 0x80 ;Receiving shift reg
130 cli ;Start critical section
131
132;1: SKIP_IN_1 ;Wait for idle
133; rjmp 1b
134;2: SKIP_IN_0 ;Wait for start bit
135; rjmp 2b
136 ldi r25, BPS/2 ;Wait for half bit time
1373: dec r25
138 brne 3b
139
1404: ldi r25, BPS ;----- Bit receiving loop
1415: dec r25 ;Wait for a bit time
142 brne 5b ;/
143 lsr r24 ;Next bit
144 SKIP_IN_0 ;Get a data bit into r24.7
145 ori r24, 0x80
146 brcc 4b ;All bits received? no, continue
147
148 ldi r25, BPS/2 ;Wait for half bit time
1496: dec r25
150 brne 6b
1517: SKIP_IN_1 ;Wait for stop bit
152 rjmp 7b
153
154 out _SFR_IO_ADDR(SREG), r0 ;End of critical section
155 ret
156.endfunc
diff --git a/tmk_core/protocol/iwrap/suart.h b/tmk_core/protocol/iwrap/suart.h
deleted file mode 100644
index c634bbc2f..000000000
--- a/tmk_core/protocol/iwrap/suart.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef SUART
2#define SUART
3
4void xmit(uint8_t);
5uint8_t rcvr(void);
6uint8_t recv(void);
7
8#endif /* SUART */
diff --git a/tmk_core/protocol/iwrap/wd.h b/tmk_core/protocol/iwrap/wd.h
deleted file mode 100644
index 083d6d44d..000000000
--- a/tmk_core/protocol/iwrap/wd.h
+++ /dev/null
@@ -1,161 +0,0 @@
1/* This is from http://www.mtcnet.net/~henryvm/wdt/ */
2#ifndef _AVR_WD_H_
3#define _AVR_WD_H_
4
5#include <avr/io.h>
6
7/*
8Copyright (c) 2009, Curt Van Maanen
9
10Permission to use, copy, modify, and/or distribute this software for any
11purpose with or without fee is hereby granted, provided that the above
12copyright notice and this permission notice appear in all copies.
13
14THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
15WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
16MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
17ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
18WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
19ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
20OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
21
22
23include usage-
24 #include "wd.h" //if in same directory as project
25 #include <avr/wd.h> //if wd.h is in avr directory
26
27set watchdog modes and prescale
28
29usage-
30 WD_SET(mode,[timeout]); //prescale always set
31
32modes-
33 WD_OFF disabled
34 WD_RST normal reset mode
35 WD_IRQ interrupt only mode (if supported)
36 WD_RST_IRQ interrupt+reset mode (if supported)
37
38timeout-
39 WDTO_15MS default if no timeout provided
40 WDTO_30MS
41 WDTO_60MS
42 WDTO_120MS
43 WDTO_250MS
44 WDTO_500MS
45 WDTO_1S
46 WDTO_2S
47 WDTO_4S (if supported)
48 WDTO_8S (if supported)
49
50examples-
51 WD_SET(WD_RST,WDTO_1S); //reset mode, 1s timeout
52 WD_SET(WD_OFF); //watchdog disabled (if not fused on)
53 WD_SET(WD_RST); //reset mode, 15ms (default timeout)
54 WD_SET(WD_IRQ,WDTO_120MS); //interrupt only mode, 120ms timeout
55 WD_SET(WD_RST_IRQ,WDTO_2S); //interrupt+reset mode, 2S timeout
56
57
58for enhanced watchdogs, if the watchdog is not being used WDRF should be
59cleared on every power up or reset, along with disabling the watchdog-
60 WD_DISABLE(); //clear WDRF, then turn off watchdog
61
62*/
63
64// reset registers to the same name (MCUCSR)
65#if !defined(MCUCSR)
66# define MCUCSR MCUSR
67#endif
68
69// watchdog registers to the same name (WDTCSR)
70#if !defined(WDTCSR)
71# define WDTCSR WDTCR
72#endif
73
74// if enhanced watchdog, define irq values, create disable macro
75#if defined(WDIF)
76# define WD_IRQ 0xC0
77# define WD_RST_IRQ 0xC8
78# define WD_DISABLE() \
79 do { \
80 MCUCSR &= ~(1 << WDRF); \
81 WD_SET(WD_OFF); \
82 } while (0)
83#endif
84
85// all watchdogs
86#define WD_RST 8
87#define WD_OFF 0
88
89// prescale values
90#define WDTO_15MS 0
91#define WDTO_30MS 1
92#define WDTO_60MS 2
93#define WDTO_120MS 3
94#define WDTO_250MS 4
95#define WDTO_500MS 5
96#define WDTO_1S 6
97#define WDTO_2S 7
98
99// prescale values for avrs with WDP3
100#if defined(WDP3)
101# define WDTO_4S 0x20
102# define WDTO_8S 0x21
103#endif
104
105// watchdog reset
106#define WDR() __asm__ __volatile__("wdr")
107
108// avr reset using watchdog
109#define WD_AVR_RESET() \
110 do { \
111 __asm__ __volatile__("cli"); \
112 WD_SET_UNSAFE(WD_RST); \
113 while (1) \
114 ; \
115 } while (0)
116
117/*set the watchdog-
1181. save SREG
1192. turn off irq's
1203. reset watchdog timer
1214. enable watchdog change
1225. write watchdog value
1236. restore SREG (restoring irq status)
124*/
125#define WD_SET(val, ...) \
126 __asm__ __volatile__("in __tmp_reg__,__SREG__" \
127 "\n\t" \
128 "cli" \
129 "\n\t" \
130 "wdr" \
131 "\n\t" \
132 "sts %[wdreg],%[wden]" \
133 "\n\t" \
134 "sts %[wdreg],%[wdval]" \
135 "\n\t" \
136 "out __SREG__,__tmp_reg__" \
137 "\n\t" \
138 : \
139 : [ wdreg ] "M"(&WDTCSR), [ wden ] "r"((uint8_t)(0x18)), [ wdval ] "r"((uint8_t)(val | (__VA_ARGS__ + 0))) \
140 : "r0")
141
142/*set the watchdog when I bit in SREG known to be clear-
1431. reset watchdog timer
1442. enable watchdog change
1455. write watchdog value
146*/
147#define WD_SET_UNSAFE(val, ...) \
148 __asm__ __volatile__("wdr" \
149 "\n\t" \
150 "sts %[wdreg],%[wden]" \
151 "\n\t" \
152 "sts %[wdreg],%[wdval]" \
153 "\n\t" \
154 : \
155 : [ wdreg ] "M"(&WDTCSR), [ wden ] "r"((uint8_t)(0x18)), [ wdval ] "r"((uint8_t)(val | (__VA_ARGS__ + 0))))
156
157// for compatibility with avr/wdt.h
158#define wdt_enable(val) WD_SET(WD_RST, val)
159#define wdt_disable() WD_SET(WD_OFF)
160
161#endif /* _AVR_WD_H_ */
diff --git a/tmk_core/readme.md b/tmk_core/readme.md
index 5b719bca5..a754cfee4 100644
--- a/tmk_core/readme.md
+++ b/tmk_core/readme.md
@@ -84,8 +84,8 @@ Architecture
84 / /| Keys/Mouse | Protocol |d| | Action | | | Protocol | 84 / /| Keys/Mouse | Protocol |d| | Action | | | Protocol |
85 /__________/ |<-----------| LUFA |r| | Layer, Tap | | | Matrix | 85 /__________/ |<-----------| LUFA |r| | Layer, Tap | | | Matrix |
86 |.--------.| | LED | V-USB |i| |-------------| | | PS/2,IBM | __________________ 86 |.--------.| | LED | V-USB |i| |-------------| | | PS/2,IBM | __________________
87 || || |----------->| iWRAP(BT)|v| | Keymap | | | ADB,M0110| Keys / /_/_/_/_/_/_/_/ /| 87 || || |----------->| UART |v| | Keymap | | | ADB,M0110| Keys / /_/_/_/_/_/_/_/ /|
88 || Host || | Console | UART |e| | Mousekey | | | SUN/NEWS |<----------/ /_/_/_/_/_/_/_/ / / 88 || Host || | Console | |e| | Mousekey | | | SUN/NEWS |<----------/ /_/_/_/_/_/_/_/ / /
89 ||________||/.<-----------| |r| | Report | | | X68K/PC98| Control / /_/_/_/_/_/_/_/ / / 89 ||________||/.<-----------| |r| | Report | | | X68K/PC98| Control / /_/_/_/_/_/_/_/ / /
90 `_========_'/| |---------------------------------------------|-------->/___ /_______/ ___/ / 90 `_========_'/| |---------------------------------------------|-------->/___ /_______/ ___/ /
91 |_o______o_|/ | Sendchar, Print, Debug, Command, ... | |_________________|/ 91 |_o______o_|/ | Sendchar, Print, Debug, Command, ... | |_________________|/
@@ -133,7 +133,6 @@ Files and Directories
133### Keyboard Protocols 133### Keyboard Protocols
134* lufa/ - LUFA USB stack 134* lufa/ - LUFA USB stack
135* vusb/ - Objective Development V-USB 135* vusb/ - Objective Development V-USB
136* iwrap/ - Bluetooth HID for Bluegiga iWRAP
137* ps2.c - PS/2 protocol 136* ps2.c - PS/2 protocol
138* adb.c - Apple Desktop Bus protocol 137* adb.c - Apple Desktop Bus protocol
139* m0110.c - Macintosh 128K/512K/Plus keyboard protocol 138* m0110.c - Macintosh 128K/512K/Plus keyboard protocol