1f14f526d02b14fd0b8c1ac4ec413e4577ad5f62eLev Babiev/* 2f14f526d02b14fd0b8c1ac4ec413e4577ad5f62eLev Babiev * HID driver for TopSeed Cyberlink remote 3f14f526d02b14fd0b8c1ac4ec413e4577ad5f62eLev Babiev * 4f14f526d02b14fd0b8c1ac4ec413e4577ad5f62eLev Babiev * Copyright (c) 2008 Lev Babiev 5f14f526d02b14fd0b8c1ac4ec413e4577ad5f62eLev Babiev * based on hid-cherry driver 6bf280628fca93c4c341587ec914863dcc395af72Wayne Thomas * 7bf280628fca93c4c341587ec914863dcc395af72Wayne Thomas * Modified to also support BTC "Emprex 3009URF III Vista MCE Remote" by 8bf280628fca93c4c341587ec914863dcc395af72Wayne Thomas * Wayne Thomas 2010. 9540010812179a16d3d00fb8363bb06ee83af25b8Kees Bakker * 10540010812179a16d3d00fb8363bb06ee83af25b8Kees Bakker * Modified to support Conceptronic CLLRCMCE by 11540010812179a16d3d00fb8363bb06ee83af25b8Kees Bakker * Kees Bakker 2010. 12f14f526d02b14fd0b8c1ac4ec413e4577ad5f62eLev Babiev */ 13f14f526d02b14fd0b8c1ac4ec413e4577ad5f62eLev Babiev 14f14f526d02b14fd0b8c1ac4ec413e4577ad5f62eLev Babiev/* 15f14f526d02b14fd0b8c1ac4ec413e4577ad5f62eLev Babiev * This program is free software; you can redistribute it and/or modify it 16f14f526d02b14fd0b8c1ac4ec413e4577ad5f62eLev Babiev * under the terms of the GNU General Public License as published by the Free 17f14f526d02b14fd0b8c1ac4ec413e4577ad5f62eLev Babiev * Software Foundation; either version 2 of the License, or (at your option) 18f14f526d02b14fd0b8c1ac4ec413e4577ad5f62eLev Babiev * any later version. 19f14f526d02b14fd0b8c1ac4ec413e4577ad5f62eLev Babiev */ 20f14f526d02b14fd0b8c1ac4ec413e4577ad5f62eLev Babiev 21f14f526d02b14fd0b8c1ac4ec413e4577ad5f62eLev Babiev#include <linux/device.h> 22f14f526d02b14fd0b8c1ac4ec413e4577ad5f62eLev Babiev#include <linux/hid.h> 23f14f526d02b14fd0b8c1ac4ec413e4577ad5f62eLev Babiev#include <linux/module.h> 24f14f526d02b14fd0b8c1ac4ec413e4577ad5f62eLev Babiev 25f14f526d02b14fd0b8c1ac4ec413e4577ad5f62eLev Babiev#include "hid-ids.h" 26f14f526d02b14fd0b8c1ac4ec413e4577ad5f62eLev Babiev 27f14f526d02b14fd0b8c1ac4ec413e4577ad5f62eLev Babiev#define ts_map_key_clear(c) hid_map_usage_clear(hi, usage, bit, max, \ 28f14f526d02b14fd0b8c1ac4ec413e4577ad5f62eLev Babiev EV_KEY, (c)) 29f14f526d02b14fd0b8c1ac4ec413e4577ad5f62eLev Babievstatic int ts_input_mapping(struct hid_device *hdev, struct hid_input *hi, 30f14f526d02b14fd0b8c1ac4ec413e4577ad5f62eLev Babiev struct hid_field *field, struct hid_usage *usage, 31f14f526d02b14fd0b8c1ac4ec413e4577ad5f62eLev Babiev unsigned long **bit, int *max) 32f14f526d02b14fd0b8c1ac4ec413e4577ad5f62eLev Babiev{ 33bf280628fca93c4c341587ec914863dcc395af72Wayne Thomas if ((usage->hid & HID_USAGE_PAGE) != HID_UP_LOGIVENDOR) 34f14f526d02b14fd0b8c1ac4ec413e4577ad5f62eLev Babiev return 0; 35f14f526d02b14fd0b8c1ac4ec413e4577ad5f62eLev Babiev 36f14f526d02b14fd0b8c1ac4ec413e4577ad5f62eLev Babiev switch (usage->hid & HID_USAGE) { 37bf280628fca93c4c341587ec914863dcc395af72Wayne Thomas case 0x00d: ts_map_key_clear(KEY_MEDIA); break; 38bf280628fca93c4c341587ec914863dcc395af72Wayne Thomas case 0x024: ts_map_key_clear(KEY_MENU); break; 39bf280628fca93c4c341587ec914863dcc395af72Wayne Thomas case 0x025: ts_map_key_clear(KEY_TV); break; 40540010812179a16d3d00fb8363bb06ee83af25b8Kees Bakker case 0x027: ts_map_key_clear(KEY_MODE); break; 41bf280628fca93c4c341587ec914863dcc395af72Wayne Thomas case 0x031: ts_map_key_clear(KEY_AUDIO); break; 42bf280628fca93c4c341587ec914863dcc395af72Wayne Thomas case 0x032: ts_map_key_clear(KEY_TEXT); break; 43bf280628fca93c4c341587ec914863dcc395af72Wayne Thomas case 0x033: ts_map_key_clear(KEY_CHANNEL); break; 44bf280628fca93c4c341587ec914863dcc395af72Wayne Thomas case 0x047: ts_map_key_clear(KEY_MP3); break; 45bf280628fca93c4c341587ec914863dcc395af72Wayne Thomas case 0x048: ts_map_key_clear(KEY_TV2); break; 46bf280628fca93c4c341587ec914863dcc395af72Wayne Thomas case 0x049: ts_map_key_clear(KEY_CAMERA); break; 47bf280628fca93c4c341587ec914863dcc395af72Wayne Thomas case 0x04a: ts_map_key_clear(KEY_VIDEO); break; 48bf280628fca93c4c341587ec914863dcc395af72Wayne Thomas case 0x04b: ts_map_key_clear(KEY_ANGLE); break; 49bf280628fca93c4c341587ec914863dcc395af72Wayne Thomas case 0x04c: ts_map_key_clear(KEY_LANGUAGE); break; 50bf280628fca93c4c341587ec914863dcc395af72Wayne Thomas case 0x04d: ts_map_key_clear(KEY_SUBTITLE); break; 51bf280628fca93c4c341587ec914863dcc395af72Wayne Thomas case 0x050: ts_map_key_clear(KEY_RADIO); break; 52bf280628fca93c4c341587ec914863dcc395af72Wayne Thomas case 0x05a: ts_map_key_clear(KEY_TEXT); break; 53bf280628fca93c4c341587ec914863dcc395af72Wayne Thomas case 0x05b: ts_map_key_clear(KEY_RED); break; 54bf280628fca93c4c341587ec914863dcc395af72Wayne Thomas case 0x05c: ts_map_key_clear(KEY_GREEN); break; 55bf280628fca93c4c341587ec914863dcc395af72Wayne Thomas case 0x05d: ts_map_key_clear(KEY_YELLOW); break; 56bf280628fca93c4c341587ec914863dcc395af72Wayne Thomas case 0x05e: ts_map_key_clear(KEY_BLUE); break; 57f14f526d02b14fd0b8c1ac4ec413e4577ad5f62eLev Babiev default: 58f14f526d02b14fd0b8c1ac4ec413e4577ad5f62eLev Babiev return 0; 59f14f526d02b14fd0b8c1ac4ec413e4577ad5f62eLev Babiev } 60f14f526d02b14fd0b8c1ac4ec413e4577ad5f62eLev Babiev 61f14f526d02b14fd0b8c1ac4ec413e4577ad5f62eLev Babiev return 1; 62f14f526d02b14fd0b8c1ac4ec413e4577ad5f62eLev Babiev} 63f14f526d02b14fd0b8c1ac4ec413e4577ad5f62eLev Babiev 64f14f526d02b14fd0b8c1ac4ec413e4577ad5f62eLev Babievstatic const struct hid_device_id ts_devices[] = { 65f14f526d02b14fd0b8c1ac4ec413e4577ad5f62eLev Babiev { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED, USB_DEVICE_ID_TOPSEED_CYBERLINK) }, 66bf280628fca93c4c341587ec914863dcc395af72Wayne Thomas { HID_USB_DEVICE(USB_VENDOR_ID_BTC, USB_DEVICE_ID_BTC_EMPREX_REMOTE) }, 67c3dc66de59531c921c4638b1285075ea1c831186Jiri Kosina { HID_USB_DEVICE(USB_VENDOR_ID_BTC, USB_DEVICE_ID_BTC_EMPREX_REMOTE_2) }, 68540010812179a16d3d00fb8363bb06ee83af25b8Kees Bakker { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED2, USB_DEVICE_ID_TOPSEED2_RF_COMBO) }, 69b9e4b1e0cd401e915e3ba97afc152946f78f9f0bDennis Kügler { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_WIRELESS) }, 70f14f526d02b14fd0b8c1ac4ec413e4577ad5f62eLev Babiev { } 71f14f526d02b14fd0b8c1ac4ec413e4577ad5f62eLev Babiev}; 72f14f526d02b14fd0b8c1ac4ec413e4577ad5f62eLev BabievMODULE_DEVICE_TABLE(hid, ts_devices); 73f14f526d02b14fd0b8c1ac4ec413e4577ad5f62eLev Babiev 74f14f526d02b14fd0b8c1ac4ec413e4577ad5f62eLev Babievstatic struct hid_driver ts_driver = { 75f14f526d02b14fd0b8c1ac4ec413e4577ad5f62eLev Babiev .name = "topseed", 76f14f526d02b14fd0b8c1ac4ec413e4577ad5f62eLev Babiev .id_table = ts_devices, 77f14f526d02b14fd0b8c1ac4ec413e4577ad5f62eLev Babiev .input_mapping = ts_input_mapping, 78f14f526d02b14fd0b8c1ac4ec413e4577ad5f62eLev Babiev}; 79f14f526d02b14fd0b8c1ac4ec413e4577ad5f62eLev Babiev 80a24f423bdf253ccee369adc6c5451b40a0716fbbPeter Huewestatic int __init ts_init(void) 81f14f526d02b14fd0b8c1ac4ec413e4577ad5f62eLev Babiev{ 82f14f526d02b14fd0b8c1ac4ec413e4577ad5f62eLev Babiev return hid_register_driver(&ts_driver); 83f14f526d02b14fd0b8c1ac4ec413e4577ad5f62eLev Babiev} 84f14f526d02b14fd0b8c1ac4ec413e4577ad5f62eLev Babiev 85a24f423bdf253ccee369adc6c5451b40a0716fbbPeter Huewestatic void __exit ts_exit(void) 86f14f526d02b14fd0b8c1ac4ec413e4577ad5f62eLev Babiev{ 87f14f526d02b14fd0b8c1ac4ec413e4577ad5f62eLev Babiev hid_unregister_driver(&ts_driver); 88f14f526d02b14fd0b8c1ac4ec413e4577ad5f62eLev Babiev} 89f14f526d02b14fd0b8c1ac4ec413e4577ad5f62eLev Babiev 90f14f526d02b14fd0b8c1ac4ec413e4577ad5f62eLev Babievmodule_init(ts_init); 91f14f526d02b14fd0b8c1ac4ec413e4577ad5f62eLev Babievmodule_exit(ts_exit); 92f14f526d02b14fd0b8c1ac4ec413e4577ad5f62eLev BabievMODULE_LICENSE("GPL"); 93