ソースを参照

Remove old media keys

main
PaulStoffregen 8年前
コミット
36f89903b1
3個のファイルの変更11行の追加22行の削除
  1. +3
    -14
      teensy3/usb_desc.c
  2. +1
    -6
      teensy3/usb_keyboard.c
  3. +7
    -2
      teensy3/usb_keyboard.h

+ 3
- 14
teensy3/usb_desc.c ファイルの表示

@@ -121,20 +121,9 @@ static uint8_t keyboard_report_desc[] = {
0x15, 0x00, // Logical Minimum (0),
0x25, 0x01, // Logical Maximum (1),
0x81, 0x02, // Input (Data, Variable, Absolute), ;Modifier keys
0x95, 0x08, // Report Count (8),
0x75, 0x01, // Report Size (1),
0x15, 0x00, // Logical Minimum (0),
0x25, 0x01, // Logical Maximum (1),
0x05, 0x0C, // Usage Page (Consumer),
0x09, 0xE9, // Usage (Volume Increment),
0x09, 0xEA, // Usage (Volume Decrement),
0x09, 0xE2, // Usage (Mute),
0x09, 0xCD, // Usage (Play/Pause),
0x09, 0xB5, // Usage (Scan Next Track),
0x09, 0xB6, // Usage (Scan Previous Track),
0x09, 0xB7, // Usage (Stop),
0x09, 0xB8, // Usage (Eject),
0x81, 0x02, // Input (Data, Variable, Absolute), ;Media keys
0x95, 0x01, // Report Count (1),
0x75, 0x08, // Report Size (8),
0x81, 0x03, // Input (Constant), ;Reserved byte
0x95, 0x05, // Report Count (5),
0x75, 0x01, // Report Size (1),
0x05, 0x08, // Usage Page (LEDs),

+ 1
- 6
teensy3/usb_keyboard.c ファイルの表示

@@ -43,9 +43,6 @@
// 16=right ctrl, 32=right shift, 64=right alt, 128=right gui
uint8_t keyboard_modifier_keys=0;

// which media keys are currently pressed
uint8_t keyboard_media_keys=0;

// which keys are currently pressed, up to 6 keys may be down at once
uint8_t keyboard_keys[6]={0,0,0,0,0,0};

@@ -454,8 +451,6 @@ void usb_keyboard_release_all(void)

anybits = keyboard_modifier_keys;
keyboard_modifier_keys = 0;
anybits |= keyboard_media_keys;
keyboard_media_keys = 0;
for (i=0; i < 6; i++) {
anybits |= keyboard_keys[i];
keyboard_keys[i] = 0;
@@ -556,7 +551,7 @@ int usb_keyboard_send(void)
yield();
}
*(tx_packet->buf) = keyboard_modifier_keys;
*(tx_packet->buf + 1) = keyboard_media_keys;
*(tx_packet->buf + 1) = 0;
memcpy(tx_packet->buf + 2, keyboard_keys, 6);
tx_packet->len = 8;
usb_tx(KEYBOARD_ENDPOINT, tx_packet);

+ 7
- 2
teensy3/usb_keyboard.h ファイルの表示

@@ -54,7 +54,6 @@ int usb_keyboard_send(void);
void usb_keymedia_release_all(void);
#endif
extern uint8_t keyboard_modifier_keys;
extern uint8_t keyboard_media_keys;
extern uint8_t keyboard_keys[6];
extern uint8_t keyboard_protocol;
extern uint8_t keyboard_idle_config;
@@ -88,7 +87,13 @@ public:
void set_key4(uint8_t c) { keyboard_keys[3] = c; }
void set_key5(uint8_t c) { keyboard_keys[4] = c; }
void set_key6(uint8_t c) { keyboard_keys[5] = c; }
void set_media(uint8_t c) { keyboard_media_keys = c; }
void set_media(uint16_t c) {
if (c == 0) {
usb_keymedia_release_all();
} else if (c >= 0xE400 && c <= 0xE7FF) {
press(c);
}
}
void send_now(void) { usb_keyboard_send(); }
void press(uint16_t n) { usb_keyboard_press_keycode(n); }
void release(uint16_t n) { usb_keyboard_release_keycode(n); }

読み込み中…
キャンセル
保存