From patchwork Thu Feb 4 10:31:45 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 76958 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o14AWGf7017320 for ; Thu, 4 Feb 2010 10:32:16 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755120Ab0BDKbx (ORCPT ); Thu, 4 Feb 2010 05:31:53 -0500 Received: from fg-out-1718.google.com ([72.14.220.157]:64727 "EHLO fg-out-1718.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751882Ab0BDKbv (ORCPT ); Thu, 4 Feb 2010 05:31:51 -0500 Received: by fg-out-1718.google.com with SMTP id 16so300041fgg.1 for ; Thu, 04 Feb 2010 02:31:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:cc:subject:references:in-reply-to :x-enigmail-version:content-type; bh=hU2AvnmCj+W7v1BKrHLndWQ0kmgomAqN42DEhOhBVjo=; b=OkdEYZ/f81jI20kTBVhr781bGbF66l5bcaf/RFwam8emR1SQO5yYvUd7To3YdOBxbt iDu90/5FBBFxThaVzDRPC7oDC5xuHrds/rvoQA24BhFovGiO966M6eo4/FlttBjGtpEW c8K5mOu1Ls/feaN+H1LFqe+lzIEZf4gJV0edE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:x-enigmail-version:content-type; b=vfYt5BZEUOc1gt6o5MFWj4w2W+0W8CLTLeC/fZxhvTfW5WgExXCxCSB9+29vB5ILQ9 fYokcV/qPJ2BkXIQjm9E+D14LY+eLvBS2daM5VBUXVR44LhreJhZcuazovZSFftpzizy 4DQj0yMXtmE/8EKTnZI3DUgKJjdy2QP9bkOq4= Received: by 10.87.63.33 with SMTP id q33mr1919832fgk.24.1265279509177; Thu, 04 Feb 2010 02:31:49 -0800 (PST) Received: from ?192.168.2.129? ([217.66.174.142]) by mx.google.com with ESMTPS id l19sm15889641fgb.25.2010.02.04.02.31.46 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 04 Feb 2010 02:31:46 -0800 (PST) Message-ID: <4B6AA211.1060707@gmail.com> Date: Thu, 04 Feb 2010 11:31:45 +0100 From: Jiri Slaby User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; cs-CZ; rv:1.9.1.7) Gecko/20100111 SUSE/3.0.1-9.1 Thunderbird/3.0.1 MIME-Version: 1.0 To: Jiri Kosina CC: Antti Palosaari , mchehab@infradead.org, linux-kernel@vger.kernel.org, Mauro Carvalho Chehab , linux-media@vger.kernel.org, Pekka Sarnila , linux-input@vger.kernel.org Subject: Re: [PATCH 1/1] media: dvb-usb/af9015, fix disconnection crashes References: <1264007972-6261-1-git-send-email-jslaby@suse.cz> <4B5CDB53.6030009@iki.fi> <4B5D6098.7010700@gmail.com> <4B5DDDFB.5020907@iki.fi> In-Reply-To: X-Enigmail-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Thu, 04 Feb 2010 10:32:17 +0000 (UTC) diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig index 139668d..0daf90a 100644 --- a/drivers/hid/Kconfig +++ b/drivers/hid/Kconfig @@ -122,6 +122,13 @@ config DRAGONRISE_FF Say Y here if you want to enable force feedback support for DragonRise Inc. game controllers. +config HID_DVB + tristate "DVB remotes support" if EMBEDDED + depends on USB_HID + default !EMBEDDED + ---help--- + Say Y here if you have DVB remote controllers. + config HID_EZKEY tristate "Ezkey" if EMBEDDED depends on USB_HID diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile index b62d4b3..a336b2a 100644 --- a/drivers/hid/Makefile +++ b/drivers/hid/Makefile @@ -30,6 +30,7 @@ obj-$(CONFIG_HID_CHERRY) += hid-cherry.o obj-$(CONFIG_HID_CHICONY) += hid-chicony.o obj-$(CONFIG_HID_CYPRESS) += hid-cypress.o obj-$(CONFIG_HID_DRAGONRISE) += hid-drff.o +obj-$(CONFIG_HID_DVB) += hid-dvb.o obj-$(CONFIG_HID_EZKEY) += hid-ezkey.o obj-$(CONFIG_HID_GYRATION) += hid-gyration.o obj-$(CONFIG_HID_KENSINGTON) += hid-kensington.o diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index 2dd9b28..678c553 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c @@ -1252,6 +1252,7 @@ static const struct hid_device_id hid_blacklist[] = { { HID_USB_DEVICE(USB_VENDOR_ID_3M, USB_DEVICE_ID_3M1968) }, { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_WCP32PU) }, { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_X5_005D) }, + { HID_USB_DEVICE(USB_VENDOR_ID_AFATECH, USB_DEVICE_ID_AFATECH_AF9016) }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ATV_IRCONTROL) }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL4) }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MIGHTYMOUSE) }, @@ -1310,6 +1311,7 @@ static const struct hid_device_id hid_blacklist[] = { { HID_USB_DEVICE(USB_VENDOR_ID_KENSINGTON, USB_DEVICE_ID_KS_SLIMBLADE) }, { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_ERGO_525V) }, { HID_USB_DEVICE(USB_VENDOR_ID_LABTEC, USB_DEVICE_ID_LABTEC_WIRELESS_KEYBOARD) }, + { HID_USB_DEVICE(USB_VENDOR_ID_LEADTEK, USB_DEVICE_ID_DTV_GOLD) }, { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_MX3000_RECEIVER) }, { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_S510_RECEIVER) }, { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_S510_RECEIVER_2) }, diff --git a/drivers/hid/hid-dvb.c b/drivers/hid/hid-dvb.c new file mode 100644 index 0000000..ee94c07 --- /dev/null +++ b/drivers/hid/hid-dvb.c @@ -0,0 +1,78 @@ +/* + * HID driver for dvb devices + * + * Copyright (c) 2010 Jiri Slaby + * + * Licensed under the GPLv2. + */ + +#include +#include +#include + +#include "hid-ids.h" + +#define FULLSPEED_INTERVAL 0x1 + +static int dvb_event(struct hid_device *hdev, struct hid_field *field, + struct hid_usage *usage, __s32 value) +{ + /* we won't get a "key up" event */ + if (value) { + input_event(field->hidinput->input, usage->type, usage->code, 1); + input_event(field->hidinput->input, usage->type, usage->code, 0); + } + return 1; +} + +static int dvb_probe(struct hid_device *hdev, const struct hid_device_id *id) +{ + unsigned long quirks = id->driver_data; + int ret; + + if (quirks & FULLSPEED_INTERVAL) + hdev->quirks |= HID_QUIRK_FULLSPEED_INTERVAL; + + ret = hid_parse(hdev); + if (ret) { + dev_err(&hdev->dev, "parse failed\n"); + goto end; + } + + ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); + if (ret) + dev_err(&hdev->dev, "hw start failed\n"); +end: + return ret; +} + +static const struct hid_device_id dvb_devices[] = { + { HID_USB_DEVICE(USB_VENDOR_ID_AFATECH, USB_DEVICE_ID_AFATECH_AF9016), + .driver_data = FULLSPEED_INTERVAL }, + { HID_USB_DEVICE(USB_VENDOR_ID_LEADTEK, USB_DEVICE_ID_DTV_GOLD), + .driver_data = FULLSPEED_INTERVAL }, + { } +}; + +MODULE_DEVICE_TABLE(hid, dvb_devices); + +static struct hid_driver dvb_driver = { + .name = "dvb", + .id_table = dvb_devices, + .probe = dvb_probe, + .event = dvb_event, +}; + +static int __init dvb_init(void) +{ + return hid_register_driver(&dvb_driver); +} + +static void __exit dvb_exit(void) +{ + hid_unregister_driver(&dvb_driver); +} + +module_init(dvb_init); +module_exit(dvb_exit); +MODULE_LICENSE("GPL v2"); diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h index 39ff98a..7a6495f 100644 --- a/drivers/hid/hid-ids.h +++ b/drivers/hid/hid-ids.h @@ -18,6 +18,9 @@ #ifndef HID_IDS_H_FILE #define HID_IDS_H_FILE +#define USB_VENDOR_ID_LEADTEK 0x0413 +#define USB_DEVICE_ID_DTV_GOLD 0x6029 + #define USB_VENDOR_ID_3M 0x0596 #define USB_DEVICE_ID_3M1968 0x0500 diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c index 88a1c69..74aac20 100644 --- a/drivers/hid/usbhid/hid-quirks.c +++ b/drivers/hid/usbhid/hid-quirks.c @@ -41,8 +41,6 @@ static const struct hid_blacklist { { USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_RUMBLEPAD, HID_QUIRK_BADPAD }, { USB_VENDOR_ID_TOPMAX, USB_DEVICE_ID_TOPMAX_COBRAPAD, HID_QUIRK_BADPAD }, - { USB_VENDOR_ID_AFATECH, USB_DEVICE_ID_AFATECH_AF9016, HID_QUIRK_FULLSPEED_INTERVAL }, - { USB_VENDOR_ID_ETURBOTOUCH, USB_DEVICE_ID_ETURBOTOUCH, HID_QUIRK_MULTI_INPUT }, { USB_VENDOR_ID_PANTHERLORD, USB_DEVICE_ID_PANTHERLORD_TWIN_USB_JOYSTICK, HID_QUIRK_MULTI_INPUT | HID_QUIRK_SKIP_OUTPUT_REPORTS }, { USB_VENDOR_ID_PLAYDOTCOM, USB_DEVICE_ID_PLAYDOTCOM_EMS_USBII, HID_QUIRK_MULTI_INPUT }, diff --git a/drivers/media/dvb/dvb-usb/af9015.c b/drivers/media/dvb/dvb-usb/af9015.c index 650c913..239c2d0 100644 --- a/drivers/media/dvb/dvb-usb/af9015.c +++ b/drivers/media/dvb/dvb-usb/af9015.c @@ -1613,7 +1613,10 @@ static int af9015_usb_probe(struct usb_interface *intf, /* interface 0 is used by DVB-T receiver and interface 1 is for remote controller (HID) */ - if (intf->cur_altsetting->desc.bInterfaceNumber == 0) { + if (intf->cur_altsetting->desc.bInterfaceNumber != 0) + return -ENODEV; + + { ret = af9015_read_config(udev); if (ret) return ret;