* Re: [PATCH 3/3] HID: wacom: Report input events immediately upon receipt
From: Benjamin Tissoires @ 2014-11-25 15:52 UTC (permalink / raw)
To: Jason Gerecke; +Cc: Jiri Kosina, linux-input, Ping Cheng
In-Reply-To: <1416871934-14133-4-git-send-email-killertofu@gmail.com>
Hi Jason,
On Mon, Nov 24, 2014 at 6:32 PM, Jason Gerecke <killertofu@gmail.com> wrote:
> Multitouch tablets cannot work properly if wacom_wac_finger_event simply
> stores the event details, since details about former fingers will be
> overwritten by later ones (causing wacom_wac_finger_report to effectively
> only report the state of the *last* finger in the packet).
>
> This patch modifies the logic so that events are generated as soon as
> possible in response to events. We do temporarily store HID_DG_TIPSWITCH
> value since the value of HID_DG_CONTACTID is (at least in for the tablets
> I've tested) not known until shortly afterwards.
>
OK, so, I don't like this one either :-(
I perfectly understand that the previous code worked in the only case
where there is only one contact per report. But this patch assumes
that the contact ID will come right after the tip switch if I
understood correctly. This assumption may strike back in the future
(like mine did), so we should be smarter.
In hid-multitouch, we count the total number of mt fields, then divide
by the number of time we see ContactID. This gives us the number of
fields per touch, and we then have a hook called when we reach this
number of fields while processing the report.
It's not perfect, but it's generic.
If you have a better idea, I am all ears, but unless the FW guys can
give us some guarantees regarding the HID descriptor*, I think we
should go for the most generic possible solution.
BTW, what I dislike here is that I am pretty sure that if we take this
one, we will have to revert part of it to have a 2-steps processing.
Relying on the order of the hid fields is simply not possible in the
long term.
Cheers,
Benjamin
* even if they give some guarantees, I am not sure I will trust them :)
> Signed-off-by: Jason Gerecke <killertofu@gmail.com>
> ---
> drivers/hid/wacom_wac.c | 77 ++++++++++++++++++++++++++++---------------------
> 1 file changed, 44 insertions(+), 33 deletions(-)
>
> diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c
> index a55e0ed..3eaa98a 100644
> --- a/drivers/hid/wacom_wac.c
> +++ b/drivers/hid/wacom_wac.c
> @@ -1412,19 +1412,40 @@ static int wacom_wac_finger_event(struct hid_device *hdev,
> {
> struct wacom *wacom = hid_get_drvdata(hdev);
> struct wacom_wac *wacom_wac = &wacom->wacom_wac;
> + struct hid_data *data = &wacom_wac->hid_data;
> + unsigned mt = wacom_wac->features.touch_max > 1;
> + struct input_dev *input = wacom_wac->input;
> + bool prox = data->tipswitch && !wacom_wac->shared->stylus_in_proximity;
> + int slot;
>
> switch (usage->hid) {
> case HID_GD_X:
> - wacom_wac->hid_data.x = value;
> + if (prox) {
> + input_report_abs(input,
> + mt ? ABS_MT_POSITION_X : ABS_X,
> + value);
> + }
> break;
> case HID_GD_Y:
> - wacom_wac->hid_data.y = value;
> + if (prox) {
> + input_report_abs(input,
> + mt ? ABS_MT_POSITION_Y : ABS_Y,
> + value);
> + }
> break;
> case HID_DG_CONTACTID:
> - wacom_wac->hid_data.id = value;
> + slot = input_mt_get_slot_by_key(input, value);
> +
> + input_mt_slot(input, slot);
> + input_mt_report_slot_state(input, MT_TOOL_FINGER, prox);
> break;
> case HID_DG_TIPSWITCH:
> - wacom_wac->hid_data.tipswitch = value;
> + data->tipswitch = value;
> + if (!mt) {
> + prox = data->tipswitch &&
> + !wacom_wac->shared->stylus_in_proximity;
> + input_report_key(input, BTN_TOUCH, prox);
> + }
> break;
> }
>
> @@ -1432,33 +1453,26 @@ static int wacom_wac_finger_event(struct hid_device *hdev,
> return 0;
> }
>
> -static void wacom_wac_finger_mt_report(struct wacom_wac *wacom_wac,
> - struct input_dev *input, bool touch)
> +static int wacom_wac_finger_touches(struct hid_device *hdev)
> {
> - int slot;
> - struct hid_data *hid_data = &wacom_wac->hid_data;
> -
> - slot = input_mt_get_slot_by_key(input, hid_data->id);
> -
> - input_mt_slot(input, slot);
> - input_mt_report_slot_state(input, MT_TOOL_FINGER, touch);
> - if (touch) {
> - input_report_abs(input, ABS_MT_POSITION_X, hid_data->x);
> - input_report_abs(input, ABS_MT_POSITION_Y, hid_data->y);
> - }
> - input_mt_sync_frame(input);
> -}
> + struct wacom *wacom = hid_get_drvdata(hdev);
> + struct wacom_wac *wacom_wac = &wacom->wacom_wac;
> + struct input_dev *input = wacom_wac->input;
> + unsigned touch_max = wacom_wac->features.touch_max;
> + int count = 0;
> + int i;
>
> -static void wacom_wac_finger_single_touch_report(struct wacom_wac *wacom_wac,
> - struct input_dev *input, bool touch)
> -{
> - struct hid_data *hid_data = &wacom_wac->hid_data;
> + if (touch_max == 1)
> + return (wacom_wac->hid_data.tipswitch &&
> + !wacom_wac->shared->stylus_in_proximity);
>
> - if (touch) {
> - input_report_abs(input, ABS_X, hid_data->x);
> - input_report_abs(input, ABS_Y, hid_data->y);
> + for (i = 0; i < input->mt->num_slots; i++) {
> + struct input_mt_slot *ps = &input->mt->slots[i];
> + int id = input_mt_get_value(ps, ABS_MT_TRACKING_ID);
> + if (id >= 0)
> + count++;
> }
> - input_report_key(input, BTN_TOUCH, touch);
> + return count;
> }
>
> static void wacom_wac_finger_report(struct hid_device *hdev,
> @@ -1467,18 +1481,15 @@ static void wacom_wac_finger_report(struct hid_device *hdev,
> struct wacom *wacom = hid_get_drvdata(hdev);
> struct wacom_wac *wacom_wac = &wacom->wacom_wac;
> struct input_dev *input = wacom_wac->input;
> - bool touch = wacom_wac->hid_data.tipswitch &&
> - !wacom_wac->shared->stylus_in_proximity;
> unsigned touch_max = wacom_wac->features.touch_max;
>
> if (touch_max > 1)
> - wacom_wac_finger_mt_report(wacom_wac, input, touch);
> - else
> - wacom_wac_finger_single_touch_report(wacom_wac, input, touch);
> + input_mt_sync_frame(input);
> +
> input_sync(input);
>
> /* keep touch state for pen event */
> - wacom_wac->shared->touch_down = touch;
> + wacom_wac->shared->touch_down = wacom_wac_finger_touches(hdev);
> }
>
> #define WACOM_PEN_FIELD(f) (((f)->logical == HID_DG_STYLUS) || \
> --
> 2.1.3
>
^ permalink raw reply
* [PATCH] Input: Initialize input_no by -1
From: Aniroop Mathur @ 2014-11-25 16:08 UTC (permalink / raw)
To: dmitry.torokhov, linux-input; +Cc: aniroop.mathur
This patch initializes input_no by -1 in order to avoid extra subtraction
operation performed everytime for allocation of an input device.
Signed-off-by: Aniroop Mathur <aniroop.mathur@gmail.com>
---
drivers/input/input.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/input/input.c b/drivers/input/input.c
index 29ca0bb..01fe49e 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -1774,7 +1774,7 @@ EXPORT_SYMBOL_GPL(input_class);
*/
struct input_dev *input_allocate_device(void)
{
- static atomic_t input_no = ATOMIC_INIT(0);
+ static atomic_t input_no = ATOMIC_INIT(-1);
struct input_dev *dev;
dev = kzalloc(sizeof(struct input_dev), GFP_KERNEL);
@@ -1789,7 +1789,7 @@ struct input_dev *input_allocate_device(void)
INIT_LIST_HEAD(&dev->node);
dev_set_name(&dev->dev, "input%ld",
- (unsigned long) atomic_inc_return(&input_no) - 1);
+ (unsigned long) atomic_inc_return(&input_no));
__module_get(THIS_MODULE);
}
--
1.9.1
^ permalink raw reply related
* Re: [PATCH] HID: wacom - PAD is independent with pen/touch
From: Ping Cheng @ 2014-11-25 19:11 UTC (permalink / raw)
To: Jiri Kosina; +Cc: linux-input, Benjamin Tissoires
In-Reply-To: <1416529872-3128-1-git-send-email-pingc@wacom.com>
Hi Jiri,
Please don't forget to merge this patch. It fixes a bad pointer issue...
Thanks,
Ping
On Thu, Nov 20, 2014 at 4:31 PM, Ping Cheng <pinglinux@gmail.com> wrote:
> PAD can be on pen interface (Intuos Pro and Cintiq series) or touch
> interface (Bamboo PT and Intuos PT series) or its own interface
> (Bamboo pen-only and Intuos Pen M/S). We need to mark it independently.
>
> Signed-off-by: Ping Cheng <pingc@wacom.com>
> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
> ---
> drivers/hid/wacom_sys.c | 8 +++++---
> drivers/hid/wacom_wac.h | 1 +
> 2 files changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c
> index 68b6cd6..eb55316 100644
> --- a/drivers/hid/wacom_sys.c
> +++ b/drivers/hid/wacom_sys.c
> @@ -1135,7 +1135,7 @@ static void wacom_clean_inputs(struct wacom *wacom)
> input_free_device(wacom->wacom_wac.input);
> }
> if (wacom->wacom_wac.pad_input) {
> - if (wacom->wacom_wac.input_registered)
> + if (wacom->wacom_wac.pad_registered)
> input_unregister_device(wacom->wacom_wac.pad_input);
> else
> input_free_device(wacom->wacom_wac.pad_input);
> @@ -1162,6 +1162,7 @@ static int wacom_register_inputs(struct wacom *wacom)
> error = input_register_device(input_dev);
> if (error)
> return error;
> + wacom_wac->input_registered = true;
> }
>
> error = wacom_setup_pad_input_capabilities(pad_input_dev, wacom_wac);
> @@ -1174,22 +1175,23 @@ static int wacom_register_inputs(struct wacom *wacom)
> error = input_register_device(pad_input_dev);
> if (error)
> goto fail_register_pad_input;
> + wacom_wac->pad_registered = true;
>
> error = wacom_initialize_leds(wacom);
> if (error)
> goto fail_leds;
> }
>
> - wacom_wac->input_registered = true;
> -
> return 0;
>
> fail_leds:
> input_unregister_device(pad_input_dev);
> pad_input_dev = NULL;
> + wacom_wac->pad_registered = false;
> fail_register_pad_input:
> input_unregister_device(input_dev);
> wacom_wac->input = NULL;
> + wacom_wac->input_registered = false;
> return error;
> }
>
> diff --git a/drivers/hid/wacom_wac.h b/drivers/hid/wacom_wac.h
> index 0f0b85e..128cbb3 100644
> --- a/drivers/hid/wacom_wac.h
> +++ b/drivers/hid/wacom_wac.h
> @@ -183,6 +183,7 @@ struct wacom_wac {
> struct input_dev *input;
> struct input_dev *pad_input;
> bool input_registered;
> + bool pad_registered;
> int pid;
> int battery_capacity;
> int num_contacts_left;
> --
> 1.9.1
>
^ permalink raw reply
* Re: [PATCH] HID: wacom - PAD is independent with pen/touch
From: Jiri Kosina @ 2014-11-25 19:56 UTC (permalink / raw)
To: Ping Cheng; +Cc: linux-input, Benjamin Tissoires
In-Reply-To: <CAF8JNh+MrEPKLQ9-KPW3T25zT_AFs9jh2F1+d9ba=xWFxwsF6Q@mail.gmail.com>
On Tue, 25 Nov 2014, Ping Cheng wrote:
> Please don't forget to merge this patch. It fixes a bad pointer issue...
Hi Ping,
yes, it's in my queue for this evening or tomorrow.
I will also add Cc: stable, ok?
Thanks,
--
Jiri Kosina
SUSE Labs
^ permalink raw reply
* LUCKY WINNER IN THE PEUGEOT AUTOMOBILES PROMOTION
From: PEUGEOT AUTOMOBILES PROMOTION OFFICE @ 2014-11-25 20:43 UTC (permalink / raw)
Name:.............
^ permalink raw reply
* Re: [git pull] Input updates for 3.18-rc4
From: ulrik.debie-os @ 2014-11-25 21:23 UTC (permalink / raw)
To: Marcus Overhagen
Cc: Dmitry Torokhov, Benjamin Tissoires, Hans de Goede,
linux-kernel@vger.kernel.org, linux-input, Jiri Kosina
In-Reply-To: <CAJBHPojucTj27EVLQRjDHZJe6bwZW3i-brwQ9N8mVY3rTp8koA@mail.gmail.com>
Hi,
On Wed, Nov 19, 2014 at 11:21:31PM +0100, Marcus Overhagen wrote:
> Hi,
>
> when moving a single finger [3] seems to be one of 0x21, 0x25, 0x31, 0x35
> moving two fingers [3] seems to be mostly 0x22, 0x26, 0x32, 0x36 but
> also sometimes it's 0x42, 0x46, 0x52, 0x56.
> It seems to occationally seems to switch between these two groups
> after touching the pad with three or more fingers, but not every time.
>
> Moving three fingers I see[3] beeing 0x26, 0x36, 0x76, 0x66 (probably more)
>
> regards
> Marcus
Ok, after some digging through the packet dump kindly provided by Marcus,
it is clear that Documentation/input/elantech.txt is not correctly
representing anymore the packets of the v4 hardware. There should be some
0 and 1's replaced by x because they are currently "don't know" and definitely
not always 0 or 1.
Example:
He has 0x26,0x36,0x46,0x56,0x66,0x76 in packet[3], and the documentation had
the bits as:
id2 id1 id0 1 0 0 1 0
X X
The bits marked with X can thus be different. But when those are changed to
X==don't care then it is not trivial to differentiate them from the trackpoint
that has the following signature for that byte:
0 0 ~sy ~sx 0 1 1 0
I'm considering the following change:
The test
t = get_unaligned_le32(&packet[0]);
switch (t & ~7U) {
case 0x06000030U:
case 0x16008020U:
case 0x26800010U:
case 0x36808000U:
could be moved to elantech_packet_check_v3/4() instead of the
simpler test on the lowest nibble of packet[3] (and keep the etd->tp_dev check):
if ((packet[3] & 0x0f) == 0x06 && etd->tp_dev)
return PACKET_TRACKPOINT;
I'll think a little bit more on it. Based on the packet dump I have this
seems to allow a perfect discrimation between trackpoint and touchpad packets.
Thanks,
Regards,
Ulrik
^ permalink raw reply
* Re: [PATCH] HID: wacom - PAD is independent with pen/touch
From: Ping Cheng @ 2014-11-25 22:33 UTC (permalink / raw)
To: Jiri Kosina; +Cc: linux-input, Benjamin Tissoires
In-Reply-To: <alpine.LNX.2.00.1411252056130.23174@pobox.suse.cz>
On Tue, Nov 25, 2014 at 11:56 AM, Jiri Kosina <jkosina@suse.cz> wrote:
> On Tue, 25 Nov 2014, Ping Cheng wrote:
>
>> Please don't forget to merge this patch. It fixes a bad pointer issue...
>
> Hi Ping,
>
> yes, it's in my queue for this evening or tomorrow.
Thank you.
> I will also add Cc: stable, ok?
If you Cc this one to stable, please also include my other three
patches, dated Nov. 18, 2014, under your wacom-3.19 branch. Those four
patches go together to fix a system freeze issue caused by Bamboo Pen
only device.
Cheers,
Ping
^ permalink raw reply
* Re: [PATCH] HID: wacom - PAD is independent with pen/touch
From: Jiri Kosina @ 2014-11-25 22:34 UTC (permalink / raw)
To: Ping Cheng; +Cc: linux-input, Benjamin Tissoires
In-Reply-To: <CAF8JNhLoEHz9KOyMhOQoL9dECWZaGRJ3iUqWFM8UCc+UTw2rmw@mail.gmail.com>
On Tue, 25 Nov 2014, Ping Cheng wrote:
> > I will also add Cc: stable, ok?
>
> If you Cc this one to stable, please also include my other three
> patches, dated Nov. 18, 2014, under your wacom-3.19 branch. Those four
> patches go together to fix a system freeze issue caused by Bamboo Pen
> only device.
Gah, I was sure I did, but looking at the tree, I didn't. Thanks for
pointing that out, I will sort it out.
--
Jiri Kosina
SUSE Labs
^ permalink raw reply
* Re: [PATCH v2 1/2] Input: add regulator haptic driver
From: Pankaj Dubey @ 2014-11-26 5:31 UTC (permalink / raw)
To: Jaewon Kim, Kukjin Kim, Dmitry Torokhov, Dan Murphy, Chanwoo Choi,
Hyunhee Kim
Cc: linux-kernel, linux-input, linux-samsung-soc
In-Reply-To: <1416840651-17141-2-git-send-email-jaewon02.kim@samsung.com>
Hi Jaewon,
On Monday 24 November 2014 08:20 PM, Jaewon Kim wrote:
> This patch adds support for haptic driver controlled by
> voltage of regulator. And this driver support for
> Force Feedback interface from input framework
>
> Signed-off-by: Jaewon Kim <jaewon02.kim@samsung.com>
> Signed-off-by: Hyunhee Kim <hyunhee.kim@samsung.com>
> Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
> ---
> .../devicetree/bindings/input/regulator-haptic.txt | 24 ++
> drivers/input/misc/Kconfig | 11 +
> drivers/input/misc/Makefile | 1 +
> drivers/input/misc/regulator-haptic.c | 247 ++++++++++++++++++++
> include/linux/input/regulator-haptic.h | 30 +++
> 5 files changed, 313 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/input/regulator-haptic.txt
> create mode 100644 drivers/input/misc/regulator-haptic.c
> create mode 100644 include/linux/input/regulator-haptic.h
>
> diff --git a/Documentation/devicetree/bindings/input/regulator-haptic.txt b/Documentation/devicetree/bindings/input/regulator-haptic.txt
> new file mode 100644
> index 0000000..5a44e8f
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/input/regulator-haptic.txt
> @@ -0,0 +1,24 @@
> +* Requlator Haptic Device Tree Bindings
Nit: %s/Requlator/Regulator
> +
> +The regulator haptic driver controlled by voltage of regulator.
> +This driver implemented via Force Feedback interface.
> +
[Snip]
> diff --git a/include/linux/input/regulator-haptic.h b/include/linux/input/regulator-haptic.h
> new file mode 100644
> index 0000000..15a629c
> --- /dev/null
> +++ b/include/linux/input/regulator-haptic.h
> @@ -0,0 +1,30 @@
> +/*
> + * Regulator Haptic Platform Data
> + *
> + * Copyright (c) 2014 Samsung Electronics Co., Ltd.
> + * Author: Jaewon Kim <jaewon02.kim@samsung.com>
> + * Author: Hyunhee Kim <hyunhee.kim@samsung.com>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + */
> +
> +#ifndef _REGULATOR_HAPTIC_H
> +
Please define _REGULATOR_HAPTIC_H here as:
#define _REGULATOR_HAPTIC_H
> +/*
> + * struct regulator_haptic_data - Platform device data
> + *
> + * @regulator: Power supply to the haptic motor
> + * @max_volt: maximum voltage value supplied to the haptic motor.
> + * <The unit of the voltage is a micro>
> + * @min_volt: minimum voltage value supplied to the haptic motor.
> + * <The unit of the voltage is a micro>
> + */
> +struct regulator_haptic_data {
> + struct regulator *regulator;
> + unsigned int max_volt;
> + unsigned int min_volt;
> +};
> +
> +#endif /* _REGULATOR_HAPTIC_H */
>
With these two minor fixes please feel free to add:
Reviewed-by: Pankaj Dubey <pankaj.dubey@samsung.com>
Thanks,
Pankaj Dubey
^ permalink raw reply
* Re: [PATCH] HID: wacom - PAD is independent with pen/touch
From: Jiri Kosina @ 2014-11-26 9:44 UTC (permalink / raw)
To: Ping Cheng; +Cc: linux-input, benjamin.tissoires, Ping Cheng
In-Reply-To: <1416529872-3128-1-git-send-email-pingc@wacom.com>
On Thu, 20 Nov 2014, Ping Cheng wrote:
> PAD can be on pen interface (Intuos Pro and Cintiq series) or touch
> interface (Bamboo PT and Intuos PT series) or its own interface
> (Bamboo pen-only and Intuos Pen M/S). We need to mark it independently.
>
> Signed-off-by: Ping Cheng <pingc@wacom.com>
> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Applied to for-3.19/wacom.
--
Jiri Kosina
SUSE Labs
^ permalink raw reply
* Re:Re: [PATCHv2 1/1] HID: add BETOP game controller force feedback support
From: Jiri Kosina @ 2014-11-26 13:15 UTC (permalink / raw)
To: 黄波; +Cc: linux-input, linux-kernel
In-Reply-To: <3497222f.2152a.149ec27f2c1.Coremail.huangbobupt@163.com>
On Wed, 26 Nov 2014, 黄波 wrote:
> From: Huang Bo <huangbobupt@163.com>Adds force feedback support for BETOP USB game controllers.
>
> These devices are mass produced in China.
>
> Signed-off-by: Huang Bo <huangbobupt@163.com>
It's unfortunately whitespace damaged again. If it's not possible to set
up your e-mail client not to cause whitespace damage to patches (please
see Documentation/email-clients.txt for some hints), attach the patch as
an e-mail attachment.
--
Jiri Kosina
SUSE Labs
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* [PATCH v3 0/2] Add regulator-haptic driver
From: Jaewon Kim @ 2014-11-26 13:30 UTC (permalink / raw)
To: Dmitry Torokhov, Kukjin Kim
Cc: linux-kernel, linux-samsung-soc, linux-input, Chanwoo Choi,
Pankaj Dubey, Jaewon Kim
This patch series adds regulator-haptic driver.
The regulator-haptic has haptic motor and it is controlled by
voltage of regulator via force feedback framework.
Changes in v3:
- fix typo in Documentation
- add define in header file
Changes in v2:
- remove driver owner
- merge enable/disable function
- support platform data
- fix wrong suspends_state check in regulator_haptic_resume()
Jaewon Kim (2):
Input: add regulator haptic driver
ARM: dts: Add regulator-haptic device node for exynos3250-rinato
.../devicetree/bindings/input/regulator-haptic.txt | 21 ++
arch/arm/boot/dts/exynos3250-rinato.dts | 7 +
drivers/input/misc/Kconfig | 11 +
drivers/input/misc/Makefile | 1 +
drivers/input/misc/regulator-haptic.c | 247 ++++++++++++++++++++
include/linux/input/regulator-haptic.h | 31 +++
6 files changed, 318 insertions(+)
create mode 100644 Documentation/devicetree/bindings/input/regulator-haptic.txt
create mode 100644 drivers/input/misc/regulator-haptic.c
create mode 100644 include/linux/input/regulator-haptic.h
--
1.7.9.5
^ permalink raw reply
* [PATCH v3 1/2] Input: add regulator haptic driver
From: Jaewon Kim @ 2014-11-26 13:30 UTC (permalink / raw)
To: Dmitry Torokhov, Kukjin Kim
Cc: linux-kernel, linux-samsung-soc, linux-input, Chanwoo Choi,
Pankaj Dubey, Jaewon Kim, Hyunhee Kim
In-Reply-To: <1417008602-22841-1-git-send-email-jaewon02.kim@samsung.com>
This patch adds support for haptic driver controlled by
voltage of regulator. And this driver support for
Force Feedback interface from input framework
Signed-off-by: Jaewon Kim <jaewon02.kim@samsung.com>
Signed-off-by: Hyunhee Kim <hyunhee.kim@samsung.com>
Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
Tested-by: Chanwoo Choi <cw00.choi@samsung.com>
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
Reviewed-by: Pankaj Dubey <pankaj.dubey@samsung.com>
---
.../devicetree/bindings/input/regulator-haptic.txt | 21 ++
drivers/input/misc/Kconfig | 11 +
drivers/input/misc/Makefile | 1 +
drivers/input/misc/regulator-haptic.c | 247 ++++++++++++++++++++
include/linux/input/regulator-haptic.h | 31 +++
5 files changed, 311 insertions(+)
create mode 100644 Documentation/devicetree/bindings/input/regulator-haptic.txt
create mode 100644 drivers/input/misc/regulator-haptic.c
create mode 100644 include/linux/input/regulator-haptic.h
diff --git a/Documentation/devicetree/bindings/input/regulator-haptic.txt b/Documentation/devicetree/bindings/input/regulator-haptic.txt
new file mode 100644
index 0000000..3ed1c7e
--- /dev/null
+++ b/Documentation/devicetree/bindings/input/regulator-haptic.txt
@@ -0,0 +1,21 @@
+* Regulator Haptic Device Tree Bindings
+
+Required Properties:
+ - compatible : Should be "regulator-haptic"
+ - haptic-supply : Power supply to the haptic motor.
+ [*] refer Documentation/devicetree/bindings/regulator/regulator.txt
+
+ - max-microvolt : The maximum voltage value supplied to the haptic motor.
+ [The unit of the voltage is a micro]
+
+ - min-microvolt : The minimum voltage value supplied to the haptic motor.
+ [The unit of the voltage is a micro]
+
+Example:
+
+ haptics {
+ compatible = "regulator-haptic";
+ haptic-supply = <&motor_regulator>;
+ max-microvolt = <2700000>;
+ min-microvolt = <1100000>;
+ };
diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
index 23297ab..e5e556d 100644
--- a/drivers/input/misc/Kconfig
+++ b/drivers/input/misc/Kconfig
@@ -394,6 +394,17 @@ config INPUT_CM109
To compile this driver as a module, choose M here: the module will be
called cm109.
+config INPUT_REGULATOR_HAPTIC
+ tristate "regulator haptics support"
+ select INPUT_FF_MEMLESS
+ help
+ This option enables device driver support for the haptic controlled
+ by regulator. This driver supports ff-memless interface
+ from input framework.
+
+ To compile this driver as a module, choose M here: the
+ module will be called regulator-haptic.
+
config INPUT_RETU_PWRBUTTON
tristate "Retu Power button Driver"
depends on MFD_RETU
diff --git a/drivers/input/misc/Makefile b/drivers/input/misc/Makefile
index 19c7603..1f135af 100644
--- a/drivers/input/misc/Makefile
+++ b/drivers/input/misc/Makefile
@@ -53,6 +53,7 @@ obj-$(CONFIG_INPUT_PMIC8XXX_PWRKEY) += pmic8xxx-pwrkey.o
obj-$(CONFIG_INPUT_POWERMATE) += powermate.o
obj-$(CONFIG_INPUT_PWM_BEEPER) += pwm-beeper.o
obj-$(CONFIG_INPUT_RB532_BUTTON) += rb532_button.o
+obj-$(CONFIG_INPUT_REGULATOR_HAPTIC) += regulator-haptic.o
obj-$(CONFIG_INPUT_RETU_PWRBUTTON) += retu-pwrbutton.o
obj-$(CONFIG_INPUT_GPIO_ROTARY_ENCODER) += rotary_encoder.o
obj-$(CONFIG_INPUT_SGI_BTNS) += sgi_btns.o
diff --git a/drivers/input/misc/regulator-haptic.c b/drivers/input/misc/regulator-haptic.c
new file mode 100644
index 0000000..c61dd99
--- /dev/null
+++ b/drivers/input/misc/regulator-haptic.c
@@ -0,0 +1,247 @@
+/*
+ * Regulator haptic driver
+ *
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Author: Jaewon Kim <jaewon02.kim@samsung.com>
+ * Author: Hyunhee Kim <hyunhee.kim@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/input.h>
+#include <linux/input/regulator-haptic.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/platform_device.h>
+#include <linux/regulator/consumer.h>
+#include <linux/slab.h>
+
+#define MAX_MAGNITUDE_SHIFT 16
+
+struct regulator_haptic {
+ struct device *dev;
+ struct input_dev *input_dev;
+ struct regulator *regulator;
+ struct work_struct work;
+
+ bool enabled;
+ bool suspend_state;
+ unsigned int max_volt;
+ unsigned int min_volt;
+ unsigned int intensity;
+ unsigned int magnitude;
+};
+
+static void regulator_haptic_enable(struct regulator_haptic *haptic, bool state)
+{
+ int error;
+
+ if (haptic->enabled == state)
+ return;
+
+ if (state)
+ error = regulator_enable(haptic->regulator);
+ else
+ error = regulator_disable(haptic->regulator);
+ if (error) {
+ dev_err(haptic->dev, "cannot enable regulator\n");
+ return;
+ }
+
+ haptic->enabled = state;
+}
+
+static void regulator_haptic_work(struct work_struct *work)
+{
+ struct regulator_haptic *haptic = container_of(work,
+ struct regulator_haptic, work);
+ int error;
+
+ error = regulator_set_voltage(haptic->regulator,
+ haptic->intensity + haptic->min_volt, haptic->max_volt);
+ if (error) {
+ dev_err(haptic->dev, "cannot set regulator voltage\n");
+ return;
+ }
+
+ if (haptic->magnitude)
+ regulator_haptic_enable(haptic, true);
+ else
+ regulator_haptic_enable(haptic, false);
+}
+
+static int regulator_haptic_play_effect(struct input_dev *input, void *data,
+ struct ff_effect *effect)
+{
+ struct regulator_haptic *haptic = input_get_drvdata(input);
+ u64 volt_mag_multi;
+
+ haptic->magnitude = effect->u.rumble.strong_magnitude;
+ if (!haptic->magnitude)
+ haptic->magnitude = effect->u.rumble.weak_magnitude;
+
+
+ volt_mag_multi = (u64)(haptic->max_volt - haptic->min_volt) *
+ haptic->magnitude;
+ haptic->intensity = (unsigned int)(volt_mag_multi >>
+ MAX_MAGNITUDE_SHIFT);
+
+ schedule_work(&haptic->work);
+
+ return 0;
+}
+
+static void regulator_haptic_close(struct input_dev *input)
+{
+ struct regulator_haptic *haptic = input_get_drvdata(input);
+
+ cancel_work_sync(&haptic->work);
+ regulator_haptic_enable(haptic, false);
+}
+
+#ifdef CONFIG_OF
+static int regulator_haptic_parse_dt(struct regulator_haptic *haptic)
+{
+ struct device_node *node = haptic->dev->of_node;
+ int error;
+
+ error = of_property_read_u32(node, "max-microvolt", &haptic->max_volt);
+ if (error) {
+ dev_err(haptic->dev, "cannot parse max-microvolt\n");
+ return error;
+ }
+
+ error = of_property_read_u32(node, "min-microvolt", &haptic->min_volt);
+ if (error) {
+ dev_err(haptic->dev, "cannot parse min-microvolt\n");
+ return error;
+ }
+
+ return 0;
+}
+#else
+static int regulator_haptic_parse_dt(struct regulator_haptic *haptic)
+{
+ return 0;
+}
+#endif /* CONFIG_OF */
+
+static int regulator_haptic_probe(struct platform_device *pdev)
+{
+ struct regulator_haptic *haptic;
+ struct regulator_haptic_data *data;
+ struct input_dev *input_dev;
+ int error;
+
+ haptic = devm_kzalloc(&pdev->dev, sizeof(*haptic), GFP_KERNEL);
+ if (!haptic)
+ return -ENOMEM;
+
+ haptic->dev = &pdev->dev;
+ haptic->enabled = false;
+ haptic->suspend_state = false;
+ INIT_WORK(&haptic->work, regulator_haptic_work);
+
+ if (pdev->dev.of_node) {
+ error = regulator_haptic_parse_dt(haptic);
+ if (error) {
+ dev_err(&pdev->dev, "failed to parse device tree\n");
+ return error;
+ }
+ } else {
+ data = dev_get_platdata(&pdev->dev);
+ if (data) {
+ dev_err(&pdev->dev, "failed to get platdata\n");
+ return -EINVAL;
+ }
+
+ haptic->regulator = data->regulator;
+ haptic->max_volt = data->max_volt;
+ haptic->min_volt = data->min_volt;
+ }
+
+ haptic->regulator = devm_regulator_get(&pdev->dev, "haptic");
+ if (IS_ERR(haptic->regulator)) {
+ dev_err(&pdev->dev, "failed to get regulator\n");
+ return PTR_ERR(haptic->regulator);
+ }
+
+ input_dev = devm_input_allocate_device(&pdev->dev);
+ if (!input_dev)
+ return -ENOMEM;
+
+ haptic->input_dev = input_dev;
+ haptic->input_dev->name = "regulator-haptic";
+ haptic->input_dev->dev.parent = &pdev->dev;
+ haptic->input_dev->close = regulator_haptic_close;
+ input_set_drvdata(haptic->input_dev, haptic);
+ input_set_capability(haptic->input_dev, EV_FF, FF_RUMBLE);
+
+ error = input_ff_create_memless(input_dev, NULL,
+ regulator_haptic_play_effect);
+ if (error) {
+ dev_err(&pdev->dev, "failed to create force-feedback\n");
+ return error;
+ }
+
+ error = input_register_device(haptic->input_dev);
+ if (error) {
+ dev_err(&pdev->dev, "failed to register input device\n");
+ return error;
+ }
+
+ platform_set_drvdata(pdev, haptic);
+
+ return 0;
+}
+
+static int __maybe_unused regulator_haptic_suspend(struct device *dev)
+{
+ struct platform_device *pdev = to_platform_device(dev);
+ struct regulator_haptic *haptic = platform_get_drvdata(pdev);
+
+ if (haptic->enabled) {
+ regulator_haptic_enable(haptic, false);
+ haptic->suspend_state = true;
+ }
+
+ return 0;
+}
+
+static int __maybe_unused regulator_haptic_resume(struct device *dev)
+{
+ struct platform_device *pdev = to_platform_device(dev);
+ struct regulator_haptic *haptic = platform_get_drvdata(pdev);
+
+ if (haptic->suspend_state) {
+ regulator_haptic_enable(haptic, true);
+ haptic->suspend_state = false;
+ }
+
+ return 0;
+}
+
+static SIMPLE_DEV_PM_OPS(regulator_haptic_pm_ops,
+ regulator_haptic_suspend, regulator_haptic_resume);
+
+static struct of_device_id regulator_haptic_dt_match[] = {
+ { .compatible = "regulator-haptic" },
+ {},
+};
+
+static struct platform_driver regulator_haptic_driver = {
+ .probe = regulator_haptic_probe,
+ .driver = {
+ .name = "regulator-haptic",
+ .of_match_table = regulator_haptic_dt_match,
+ .pm = ®ulator_haptic_pm_ops,
+ },
+};
+module_platform_driver(regulator_haptic_driver);
+
+MODULE_AUTHOR("Jaewon Kim <jaewon02.kim@samsung.com>");
+MODULE_AUTHOR("Hyunhee Kim <hyunhee.kim@samsung.com>");
+MODULE_DESCRIPTION("Regulator haptic driver");
+MODULE_LICENSE("GPL");
diff --git a/include/linux/input/regulator-haptic.h b/include/linux/input/regulator-haptic.h
new file mode 100644
index 0000000..05ae038
--- /dev/null
+++ b/include/linux/input/regulator-haptic.h
@@ -0,0 +1,31 @@
+/*
+ * Regulator Haptic Platform Data
+ *
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Author: Jaewon Kim <jaewon02.kim@samsung.com>
+ * Author: Hyunhee Kim <hyunhee.kim@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef _REGULATOR_HAPTIC_H
+#define _REGULATOR_HAPTIC_H
+
+/*
+ * struct regulator_haptic_data - Platform device data
+ *
+ * @regulator: Power supply to the haptic motor
+ * @max_volt: maximum voltage value supplied to the haptic motor.
+ * <The unit of the voltage is a micro>
+ * @min_volt: minimum voltage value supplied to the haptic motor.
+ * <The unit of the voltage is a micro>
+ */
+struct regulator_haptic_data {
+ struct regulator *regulator;
+ unsigned int max_volt;
+ unsigned int min_volt;
+};
+
+#endif /* _REGULATOR_HAPTIC_H */
--
1.7.9.5
^ permalink raw reply related
* [PATCH v3 2/2] ARM: dts: Add regulator-haptic device node for exynos3250-rinato
From: Jaewon Kim @ 2014-11-26 13:30 UTC (permalink / raw)
To: Dmitry Torokhov, Kukjin Kim
Cc: linux-kernel, linux-samsung-soc, linux-input, Chanwoo Choi,
Pankaj Dubey, Jaewon Kim
In-Reply-To: <1417008602-22841-1-git-send-email-jaewon02.kim@samsung.com>
This patch adds regulator-haptic device node controlled by regulator.
Signed-off-by: Jaewon Kim <jaewon02.kim@samsung.com>
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
---
arch/arm/boot/dts/exynos3250-rinato.dts | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/arch/arm/boot/dts/exynos3250-rinato.dts b/arch/arm/boot/dts/exynos3250-rinato.dts
index 84380fa..da03005 100644
--- a/arch/arm/boot/dts/exynos3250-rinato.dts
+++ b/arch/arm/boot/dts/exynos3250-rinato.dts
@@ -104,6 +104,13 @@
};
};
};
+
+ haptics {
+ compatible = "regulator-haptic";
+ haptic-supply = <&motor_reg>;
+ min-microvolt = <1100000>;
+ max-microvolt = <2700000>;
+ };
};
&adc {
--
1.7.9.5
^ permalink raw reply related
* Re: [PATCHv2 1/1] HID: add BETOP game controller force feedback support
From: Huang Bo @ 2014-11-26 13:38 UTC (permalink / raw)
To: Jiri Kosina; +Cc: linux-input, linux-kernel
In-Reply-To: <alpine.LNX.2.00.1411261414160.23174@pobox.suse.cz>
[-- Attachment #1: Type: text/plain, Size: 8924 bytes --]
On 11/26/2014 09:15 PM, Jiri Kosina wrote:
> On Wed, 26 Nov 2014, 黄波 wrote:
>
>> From: Huang Bo <huangbobupt@163.com>Adds force feedback support for BETOP USB game controllers.
>>
>> These devices are mass produced in China.
>>
>> Signed-off-by: Huang Bo <huangbobupt@163.com>
> It's unfortunately whitespace damaged again. If it's not possible to set
> up your e-mail client not to cause whitespace damage to patches (please
> see Documentation/email-clients.txt for some hints), attach the patch as
> an e-mail attachment.
>
From: Huang Bo <huangbobupt@163.com>
Adds force feedback support for BETOP USB game controllers.
These devices are mass produced in China.
Signed-off-by: Huang Bo <huangbobupt@163.com>
---
drivers/hid/Kconfig | 10 +++
drivers/hid/Makefile | 1 +
drivers/hid/hid-betopff.c | 168 +++++++++++++++++++++++++++++++++++++++++++++
drivers/hid/hid-core.c | 4 ++
drivers/hid/hid-ids.h | 9 +++
5 files changed, 192 insertions(+)
create mode 100644 drivers/hid/hid-betopff.c
diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
index 4938bd3..0a8fdc5 100755
--- a/drivers/hid/Kconfig
+++ b/drivers/hid/Kconfig
@@ -201,6 +201,16 @@ config DRAGONRISE_FF
Say Y here if you want to enable force feedback support for DragonRise Inc.
game controllers.
+config HID_BETOP_FF
+ tristate "Betop Production Inc. force feedback support"
+ depends on USB_HID
+ select INPUT_FF_MEMLESS
+ ---help---
+ Say Y here if you want to enable force feedback support for devices by
+ BETOP Production Ltd.
+ Currently the following devices are known to be supported:
+ - BETOP 2185 PC & BFM MODE
+
config HID_EMS_FF
tristate "EMS Production Inc. force feedback support"
depends on HID
diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile
index 4113999..a0546ca 100755
--- a/drivers/hid/Makefile
+++ b/drivers/hid/Makefile
@@ -46,6 +46,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-dr.o
+obj-$(CONFIG_HID_BETOP_FF) += hid-betopff.o
obj-$(CONFIG_HID_EMS_FF) += hid-emsff.o
obj-$(CONFIG_HID_ELECOM) += hid-elecom.o
obj-$(CONFIG_HID_EZKEY) += hid-ezkey.o
diff --git a/drivers/hid/hid-betopff.c b/drivers/hid/hid-betopff.c
new file mode 100644
index 0000000..b94acb2
--- /dev/null
+++ b/drivers/hid/hid-betopff.c
@@ -0,0 +1,168 @@
+/*
+ * Force feedback support for Betop based devices
+ *
+ * The devices are distributed under various names and the same USB device ID
+ * can be used in both adapters and actual game controllers.
+ *
+ * 0x11C0:0x5506 "BTP2185 PC mode Joystick"
+ * - tested with BTP2185 PC Mode.
+ *
+ * 0x11c2:0x2208 "BTP2185 BFM mode Joystick"
+ * - tested with BTP2185 BFM Mode.
+ *
+ * 0x8380:0x1850 "BTP2185 V2 PC mode USB Gamepad"
+ * - tested with BTP2185 PC Mode with another version.
+ *
+ * 0x20bc:0x5500 "BTP2185 V2 BFM mode Joystick"
+ * - tested with BTP2171s.
+ * Copyright (c) 2014 Huang Bo <huangbobupt@163.com>
+ */
+
+/*
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ */
+
+
+#include <linux/input.h>
+#include <linux/slab.h>
+#include <linux/module.h>
+#include <linux/hid.h>
+
+#include "hid-ids.h"
+
+struct betopff_device {
+ struct hid_report *report;
+};
+
+static int hid_betopff_play(struct input_dev *dev, void *data,
+ struct ff_effect *effect)
+{
+ struct hid_device *hid = input_get_drvdata(dev);
+ struct betopff_device *betopff = data;
+ __u16 left, right;
+
+ left = effect->u.rumble.strong_magnitude;
+ right = effect->u.rumble.weak_magnitude;
+
+ betopff->report->field[2]->value[0] = left / 256;
+ betopff->report->field[3]->value[0] = right / 256;
+
+ hid_hw_request(hid, betopff->report, HID_REQ_SET_REPORT);
+
+ return 0;
+}
+
+static int betopff_init(struct hid_device *hid)
+{
+ struct betopff_device *betopff;
+ struct hid_report *report;
+ struct hid_input *hidinput;
+ struct list_head *report_list =
+ &hid->report_enum[HID_OUTPUT_REPORT].report_list;
+ struct list_head *report_ptr = report_list;
+ struct input_dev *dev;
+ int error;
+ int i, j;
+ int field_count = 0;
+
+ if (list_empty(report_list)) {
+ hid_err(hid, "no output reports found\n");
+ return -ENODEV;
+ }
+
+ list_for_each_entry(hidinput, &hid->inputs, list) {
+
+ report_ptr = report_ptr->next;
+
+ if (report_ptr == report_list) {
+ hid_err(hid, "required output report is missing\n");
+ return -ENODEV;
+ }
+
+ report = list_entry(report_ptr, struct hid_report, list);
+ if (report->maxfield < 1) {
+ hid_err(hid, "no fields in the report\n");
+ return -ENODEV;
+ }
+
+ for (i = 0; i < report->maxfield; i++) {
+ for (j = 0; j < report->field[i]->report_count; j++) {
+ report->field[i]->value[j] = 0x00;
+ field_count++;
+ }
+ }
+
+ if (field_count < 4) {
+ hid_err(hid, "not enough fields in the report: %d\n",
+ field_count);
+ return -ENODEV;
+ }
+
+ betopff = kzalloc(sizeof(struct betopff_device), GFP_KERNEL);
+ if (!betopff)
+ return -ENOMEM;
+
+ dev = hidinput->input;
+ set_bit(FF_RUMBLE, dev->ffbit);
+
+ error = input_ff_create_memless(dev, betopff, hid_betopff_play);
+ if (error) {
+ kfree(betopff);
+ return error;
+ }
+
+ betopff->report = report;
+ hid_hw_request(hid, betopff->report, HID_REQ_SET_REPORT);
+ }
+
+ hid_info(hid, "Force feedback for betop devices by huangbo <huangbobupt@163.com>\n");
+
+ return 0;
+}
+
+static int betop_probe(struct hid_device *hdev, const struct hid_device_id *id)
+{
+ int ret;
+
+ if (id->driver_data)
+ hdev->quirks |= HID_QUIRK_MULTI_INPUT;
+
+ ret = hid_parse(hdev);
+ if (ret) {
+ hid_err(hdev, "parse failed\n");
+ goto err;
+ }
+
+ ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT & ~HID_CONNECT_FF);
+ if (ret) {
+ hid_err(hdev, "hw start failed\n");
+ goto err;
+ }
+
+ betopff_init(hdev);
+
+ return 0;
+err:
+ return ret;
+}
+
+static const struct hid_device_id betop_devices[] = {
+ { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185PC, USB_DEVICE_ID_BETOP_2185PC) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185BFM, USB_DEVICE_ID_BETOP_2185BFM) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185V2PC, USB_DEVICE_ID_BETOP_2185V2PC) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185V2BFM, USB_DEVICE_ID_BETOP_2185V2BFM) },
+ { }
+};
+MODULE_DEVICE_TABLE(hid, betop_devices);
+
+static struct hid_driver betop_driver = {
+ .name = "betop",
+ .id_table = betop_devices,
+ .probe = betop_probe,
+};
+module_hid_driver(betop_driver);
+
+MODULE_LICENSE("GPL");
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index a622590..90f608f 100755
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1820,6 +1820,10 @@ static const struct hid_device_id hid_have_special_driver[] = {
{ HID_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS, 0x0005) },
{ HID_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS, 0x0030) },
{ HID_USB_DEVICE(USB_VENDOR_ID_ZYDACRON, USB_DEVICE_ID_ZYDACRON_REMOTE_CONTROL) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185PC, USB_DEVICE_ID_BETOP_2185PC) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185BFM, USB_DEVICE_ID_BETOP_2185BFM) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185V2PC, USB_DEVICE_ID_BETOP_2185V2PC) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185V2BFM, USB_DEVICE_ID_BETOP_2185V2BFM) },
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_BT) },
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_NINTENDO, USB_DEVICE_ID_NINTENDO_WIIMOTE) },
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 161ee89..d3f7537 100755
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -907,6 +907,15 @@
#define USB_VENDOR_ID_ZYDACRON 0x13EC
#define USB_DEVICE_ID_ZYDACRON_REMOTE_CONTROL 0x0006
+#define USB_VENDOR_ID_BETOP_2185PC 0x11c0
+#define USB_VENDOR_ID_BETOP_2185BFM 0x11c2
+#define USB_VENDOR_ID_BETOP_2185V2PC 0x8380
+#define USB_VENDOR_ID_BETOP_2185V2BFM 0x20bc
+#define USB_DEVICE_ID_BETOP_2185PC 0x5506
+#define USB_DEVICE_ID_BETOP_2185BFM 0x2208
+#define USB_DEVICE_ID_BETOP_2185V2PC 0x1850
+#define USB_DEVICE_ID_BETOP_2185V2BFM 0x5500
+
#define USB_VENDOR_ID_ZYTRONIC 0x14c8
#define USB_DEVICE_ID_ZYTRONIC_ZXY100 0x0005
--
1.7.9.5
[-- Attachment #2: 0001-HID-add-BETOP-game-controller-force-feedback-support.patch --]
[-- Type: text/x-patch, Size: 8442 bytes --]
>From a9282c8ebb866b26b8cb7dd7ae54628301d704d6 Mon Sep 17 00:00:00 2001
From: Huang Bo <huangbobupt@163.com>
Date: Wed, 26 Nov 2014 18:21:03 +0800
Subject: [PATCH] HID: add BETOP game controller force feedback support
Adds force feedback support for BETOP USB game controllers.
These devices are mass produced in China.
Signed-off-by: Huang Bo <huangbobupt@163.com>
---
drivers/hid/Kconfig | 10 +++
drivers/hid/Makefile | 1 +
drivers/hid/hid-betopff.c | 168 +++++++++++++++++++++++++++++++++++++++++++++
drivers/hid/hid-core.c | 4 ++
drivers/hid/hid-ids.h | 9 +++
5 files changed, 192 insertions(+)
create mode 100644 drivers/hid/hid-betopff.c
diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
index 4938bd3..0a8fdc5 100755
--- a/drivers/hid/Kconfig
+++ b/drivers/hid/Kconfig
@@ -201,6 +201,16 @@ config DRAGONRISE_FF
Say Y here if you want to enable force feedback support for DragonRise Inc.
game controllers.
+config HID_BETOP_FF
+ tristate "Betop Production Inc. force feedback support"
+ depends on USB_HID
+ select INPUT_FF_MEMLESS
+ ---help---
+ Say Y here if you want to enable force feedback support for devices by
+ BETOP Production Ltd.
+ Currently the following devices are known to be supported:
+ - BETOP 2185 PC & BFM MODE
+
config HID_EMS_FF
tristate "EMS Production Inc. force feedback support"
depends on HID
diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile
index 4113999..a0546ca 100755
--- a/drivers/hid/Makefile
+++ b/drivers/hid/Makefile
@@ -46,6 +46,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-dr.o
+obj-$(CONFIG_HID_BETOP_FF) += hid-betopff.o
obj-$(CONFIG_HID_EMS_FF) += hid-emsff.o
obj-$(CONFIG_HID_ELECOM) += hid-elecom.o
obj-$(CONFIG_HID_EZKEY) += hid-ezkey.o
diff --git a/drivers/hid/hid-betopff.c b/drivers/hid/hid-betopff.c
new file mode 100644
index 0000000..b94acb2
--- /dev/null
+++ b/drivers/hid/hid-betopff.c
@@ -0,0 +1,168 @@
+/*
+ * Force feedback support for Betop based devices
+ *
+ * The devices are distributed under various names and the same USB device ID
+ * can be used in both adapters and actual game controllers.
+ *
+ * 0x11C0:0x5506 "BTP2185 PC mode Joystick"
+ * - tested with BTP2185 PC Mode.
+ *
+ * 0x11c2:0x2208 "BTP2185 BFM mode Joystick"
+ * - tested with BTP2185 BFM Mode.
+ *
+ * 0x8380:0x1850 "BTP2185 V2 PC mode USB Gamepad"
+ * - tested with BTP2185 PC Mode with another version.
+ *
+ * 0x20bc:0x5500 "BTP2185 V2 BFM mode Joystick"
+ * - tested with BTP2171s.
+ * Copyright (c) 2014 Huang Bo <huangbobupt@163.com>
+ */
+
+/*
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ */
+
+
+#include <linux/input.h>
+#include <linux/slab.h>
+#include <linux/module.h>
+#include <linux/hid.h>
+
+#include "hid-ids.h"
+
+struct betopff_device {
+ struct hid_report *report;
+};
+
+static int hid_betopff_play(struct input_dev *dev, void *data,
+ struct ff_effect *effect)
+{
+ struct hid_device *hid = input_get_drvdata(dev);
+ struct betopff_device *betopff = data;
+ __u16 left, right;
+
+ left = effect->u.rumble.strong_magnitude;
+ right = effect->u.rumble.weak_magnitude;
+
+ betopff->report->field[2]->value[0] = left / 256;
+ betopff->report->field[3]->value[0] = right / 256;
+
+ hid_hw_request(hid, betopff->report, HID_REQ_SET_REPORT);
+
+ return 0;
+}
+
+static int betopff_init(struct hid_device *hid)
+{
+ struct betopff_device *betopff;
+ struct hid_report *report;
+ struct hid_input *hidinput;
+ struct list_head *report_list =
+ &hid->report_enum[HID_OUTPUT_REPORT].report_list;
+ struct list_head *report_ptr = report_list;
+ struct input_dev *dev;
+ int error;
+ int i, j;
+ int field_count = 0;
+
+ if (list_empty(report_list)) {
+ hid_err(hid, "no output reports found\n");
+ return -ENODEV;
+ }
+
+ list_for_each_entry(hidinput, &hid->inputs, list) {
+
+ report_ptr = report_ptr->next;
+
+ if (report_ptr == report_list) {
+ hid_err(hid, "required output report is missing\n");
+ return -ENODEV;
+ }
+
+ report = list_entry(report_ptr, struct hid_report, list);
+ if (report->maxfield < 1) {
+ hid_err(hid, "no fields in the report\n");
+ return -ENODEV;
+ }
+
+ for (i = 0; i < report->maxfield; i++) {
+ for (j = 0; j < report->field[i]->report_count; j++) {
+ report->field[i]->value[j] = 0x00;
+ field_count++;
+ }
+ }
+
+ if (field_count < 4) {
+ hid_err(hid, "not enough fields in the report: %d\n",
+ field_count);
+ return -ENODEV;
+ }
+
+ betopff = kzalloc(sizeof(struct betopff_device), GFP_KERNEL);
+ if (!betopff)
+ return -ENOMEM;
+
+ dev = hidinput->input;
+ set_bit(FF_RUMBLE, dev->ffbit);
+
+ error = input_ff_create_memless(dev, betopff, hid_betopff_play);
+ if (error) {
+ kfree(betopff);
+ return error;
+ }
+
+ betopff->report = report;
+ hid_hw_request(hid, betopff->report, HID_REQ_SET_REPORT);
+ }
+
+ hid_info(hid, "Force feedback for betop devices by huangbo <huangbobupt@163.com>\n");
+
+ return 0;
+}
+
+static int betop_probe(struct hid_device *hdev, const struct hid_device_id *id)
+{
+ int ret;
+
+ if (id->driver_data)
+ hdev->quirks |= HID_QUIRK_MULTI_INPUT;
+
+ ret = hid_parse(hdev);
+ if (ret) {
+ hid_err(hdev, "parse failed\n");
+ goto err;
+ }
+
+ ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT & ~HID_CONNECT_FF);
+ if (ret) {
+ hid_err(hdev, "hw start failed\n");
+ goto err;
+ }
+
+ betopff_init(hdev);
+
+ return 0;
+err:
+ return ret;
+}
+
+static const struct hid_device_id betop_devices[] = {
+ { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185PC, USB_DEVICE_ID_BETOP_2185PC) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185BFM, USB_DEVICE_ID_BETOP_2185BFM) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185V2PC, USB_DEVICE_ID_BETOP_2185V2PC) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185V2BFM, USB_DEVICE_ID_BETOP_2185V2BFM) },
+ { }
+};
+MODULE_DEVICE_TABLE(hid, betop_devices);
+
+static struct hid_driver betop_driver = {
+ .name = "betop",
+ .id_table = betop_devices,
+ .probe = betop_probe,
+};
+module_hid_driver(betop_driver);
+
+MODULE_LICENSE("GPL");
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index a622590..90f608f 100755
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1820,6 +1820,10 @@ static const struct hid_device_id hid_have_special_driver[] = {
{ HID_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS, 0x0005) },
{ HID_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS, 0x0030) },
{ HID_USB_DEVICE(USB_VENDOR_ID_ZYDACRON, USB_DEVICE_ID_ZYDACRON_REMOTE_CONTROL) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185PC, USB_DEVICE_ID_BETOP_2185PC) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185BFM, USB_DEVICE_ID_BETOP_2185BFM) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185V2PC, USB_DEVICE_ID_BETOP_2185V2PC) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185V2BFM, USB_DEVICE_ID_BETOP_2185V2BFM) },
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_BT) },
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_NINTENDO, USB_DEVICE_ID_NINTENDO_WIIMOTE) },
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 161ee89..d3f7537 100755
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -907,6 +907,15 @@
#define USB_VENDOR_ID_ZYDACRON 0x13EC
#define USB_DEVICE_ID_ZYDACRON_REMOTE_CONTROL 0x0006
+#define USB_VENDOR_ID_BETOP_2185PC 0x11c0
+#define USB_VENDOR_ID_BETOP_2185BFM 0x11c2
+#define USB_VENDOR_ID_BETOP_2185V2PC 0x8380
+#define USB_VENDOR_ID_BETOP_2185V2BFM 0x20bc
+#define USB_DEVICE_ID_BETOP_2185PC 0x5506
+#define USB_DEVICE_ID_BETOP_2185BFM 0x2208
+#define USB_DEVICE_ID_BETOP_2185V2PC 0x1850
+#define USB_DEVICE_ID_BETOP_2185V2BFM 0x5500
+
#define USB_VENDOR_ID_ZYTRONIC 0x14c8
#define USB_DEVICE_ID_ZYTRONIC_ZXY100 0x0005
--
1.7.9.5
^ permalink raw reply related
* Re: [PATCHv2 1/1] HID: add BETOP game controller force feedback support
From: Jiri Kosina @ 2014-11-26 13:49 UTC (permalink / raw)
To: Huang Bo; +Cc: linux-input, linux-kernel
In-Reply-To: <5475D7CC.1080606@163.com>
On Wed, 26 Nov 2014, Huang Bo wrote:
> > It's unfortunately whitespace damaged again. If it's not possible to set
> > up your e-mail client not to cause whitespace damage to patches (please
> > see Documentation/email-clients.txt for some hints), attach the patch as
> > an e-mail attachment.
> >
> From: Huang Bo <huangbobupt@163.com>
>
> Adds force feedback support for BETOP USB game controllers.
> These devices are mass produced in China.
Alright, so you apparently wrote the code with incorrect formatting, as
even the version you attached doesn't have the formatting right.
Please reformat the code according to Documentation/CodingStyle and
resubmit.
Thanks,
--
Jiri Kosina
SUSE Labs
^ permalink raw reply
* Re: [git pull] Input updates for 3.18-rc4
From: Benjamin Tissoires @ 2014-11-26 14:33 UTC (permalink / raw)
To: Ulrik De Bie
Cc: Marcus Overhagen, Dmitry Torokhov, Hans de Goede,
linux-kernel@vger.kernel.org, linux-input, Jiri Kosina
In-Reply-To: <20141125212321.GA12591@lantern>
Hi Ulrik,
On Tue, Nov 25, 2014 at 4:23 PM, <ulrik.debie-os@e2big.org> wrote:
> Hi,
>
> On Wed, Nov 19, 2014 at 11:21:31PM +0100, Marcus Overhagen wrote:
>> Hi,
>>
>> when moving a single finger [3] seems to be one of 0x21, 0x25, 0x31, 0x35
>> moving two fingers [3] seems to be mostly 0x22, 0x26, 0x32, 0x36 but
>> also sometimes it's 0x42, 0x46, 0x52, 0x56.
>> It seems to occationally seems to switch between these two groups
>> after touching the pad with three or more fingers, but not every time.
>>
>> Moving three fingers I see[3] beeing 0x26, 0x36, 0x76, 0x66 (probably more)
>>
>> regards
>> Marcus
>
>
> Ok, after some digging through the packet dump kindly provided by Marcus,
> it is clear that Documentation/input/elantech.txt is not correctly
> representing anymore the packets of the v4 hardware. There should be some
> 0 and 1's replaced by x because they are currently "don't know" and definitely
> not always 0 or 1.
>
> Example:
> He has 0x26,0x36,0x46,0x56,0x66,0x76 in packet[3], and the documentation had
> the bits as:
> id2 id1 id0 1 0 0 1 0
> X X
> The bits marked with X can thus be different. But when those are changed to
> X==don't care then it is not trivial to differentiate them from the trackpoint
> that has the following signature for that byte:
> 0 0 ~sy ~sx 0 1 1 0
>
>
>
> I'm considering the following change:
> The test
>
> t = get_unaligned_le32(&packet[0]);
>
> switch (t & ~7U) {
> case 0x06000030U:
> case 0x16008020U:
> case 0x26800010U:
> case 0x36808000U:
>
> could be moved to elantech_packet_check_v3/4() instead of the
> simpler test on the lowest nibble of packet[3] (and keep the etd->tp_dev check):
> if ((packet[3] & 0x0f) == 0x06 && etd->tp_dev)
> return PACKET_TRACKPOINT;
>
> I'll think a little bit more on it. Based on the packet dump I have this
> seems to allow a perfect discrimation between trackpoint and touchpad packets.
>
Thanks for the progress on these. Do you think you will be able to get
something in shape before the final 3.18?
Dmitry, can we either revert the current patches and reschedule them
for 3.19 or at least apply one quick fix? I am starting to see a lot
of people complaining about it, and I am wondering if adding this
functionality in a -rc5 release was not a good idea :-/.
Cheers,
Benjamin
^ permalink raw reply
* Re: [PATCHv2 1/1] HID: add BETOP game controller force feedback support
From: Huang Bo @ 2014-11-26 14:16 UTC (permalink / raw)
To: Jiri Kosina; +Cc: linux-input, linux-kernel
In-Reply-To: <alpine.LNX.2.00.1411261449140.23174@pobox.suse.cz>
[-- Attachment #1: Type: text/plain, Size: 8753 bytes --]
On 11/26/2014 09:49 PM, Jiri Kosina wrote:
> On Wed, 26 Nov 2014, Huang Bo wrote:
>
>>> It's unfortunately whitespace damaged again. If it's not possible to set
>>> up your e-mail client not to cause whitespace damage to patches (please
>>> see Documentation/email-clients.txt for some hints), attach the patch as
>>> an e-mail attachment.
>>>
>> From: Huang Bo <huangbobupt@163.com>
>>
>> Adds force feedback support for BETOP USB game controllers.
>> These devices are mass produced in China.
> Alright, so you apparently wrote the code with incorrect formatting, as
> even the version you attached doesn't have the formatting right.
>
> Please reformat the code according to Documentation/CodingStyle and
> resubmit.
>
> Thanks,
>
From: Huang Bo <huangbobupt@163.com>
Adds force feedback support for BETOP USB game controllers.
These devices are mass produced in China.
Signed-off-by: Huang Bo <huangbobupt@163.com>
---
drivers/hid/Kconfig | 10 +++
drivers/hid/Makefile | 1 +
drivers/hid/hid-betopff.c | 168 +++++++++++++++++++++++++++++++++++++++++++++
drivers/hid/hid-core.c | 4 ++
drivers/hid/hid-ids.h | 5 ++
5 files changed, 188 insertions(+)
create mode 100644 drivers/hid/hid-betopff.c
diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
index 4938bd3..0a8fdc5 100755
--- a/drivers/hid/Kconfig
+++ b/drivers/hid/Kconfig
@@ -201,6 +201,16 @@ config DRAGONRISE_FF
Say Y here if you want to enable force feedback support for DragonRise Inc.
game controllers.
+config HID_BETOP_FF
+ tristate "Betop Production Inc. force feedback support"
+ depends on USB_HID
+ select INPUT_FF_MEMLESS
+ ---help---
+ Say Y here if you want to enable force feedback support for devices by
+ BETOP Production Ltd.
+ Currently the following devices are known to be supported:
+ - BETOP 2185 PC & BFM MODE
+
config HID_EMS_FF
tristate "EMS Production Inc. force feedback support"
depends on HID
diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile
index 4113999..a0546ca 100755
--- a/drivers/hid/Makefile
+++ b/drivers/hid/Makefile
@@ -46,6 +46,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-dr.o
+obj-$(CONFIG_HID_BETOP_FF) += hid-betopff.o
obj-$(CONFIG_HID_EMS_FF) += hid-emsff.o
obj-$(CONFIG_HID_ELECOM) += hid-elecom.o
obj-$(CONFIG_HID_EZKEY) += hid-ezkey.o
diff --git a/drivers/hid/hid-betopff.c b/drivers/hid/hid-betopff.c
new file mode 100644
index 0000000..447d6ba
--- /dev/null
+++ b/drivers/hid/hid-betopff.c
@@ -0,0 +1,168 @@
+/*
+ * Force feedback support for Betop based devices
+ *
+ * The devices are distributed under various names and the same USB device ID
+ * can be used in both adapters and actual game controllers.
+ *
+ * 0x11C0:0x5506 "BTP2185 PC mode Joystick"
+ * - tested with BTP2185 PC Mode.
+ *
+ * 0x11c2:0x2208 "BTP2185 BFM mode Joystick"
+ * - tested with BTP2185 BFM Mode.
+ *
+ * 0x8380:0x1850 "BTP2185 V2 PC mode USB Gamepad"
+ * - tested with BTP2185 PC Mode with another version.
+ *
+ * 0x20bc:0x5500 "BTP2185 V2 BFM mode Joystick"
+ * - tested with BTP2171s.
+ * Copyright (c) 2014 Huang Bo <huangbobupt@163.com>
+ */
+
+/*
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ */
+
+
+#include <linux/input.h>
+#include <linux/slab.h>
+#include <linux/module.h>
+#include <linux/hid.h>
+
+#include "hid-ids.h"
+
+struct betopff_device {
+ struct hid_report *report;
+};
+
+static int hid_betopff_play(struct input_dev *dev, void *data,
+ struct ff_effect *effect)
+{
+ struct hid_device *hid = input_get_drvdata(dev);
+ struct betopff_device *betopff = data;
+ __u16 left, right;
+
+ left = effect->u.rumble.strong_magnitude;
+ right = effect->u.rumble.weak_magnitude;
+
+ betopff->report->field[2]->value[0] = left / 256;
+ betopff->report->field[3]->value[0] = right / 256;
+
+ hid_hw_request(hid, betopff->report, HID_REQ_SET_REPORT);
+
+ return 0;
+}
+
+static int betopff_init(struct hid_device *hid)
+{
+ struct betopff_device *betopff;
+ struct hid_report *report;
+ struct hid_input *hidinput;
+ struct list_head *report_list =
+ &hid->report_enum[HID_OUTPUT_REPORT].report_list;
+ struct list_head *report_ptr = report_list;
+ struct input_dev *dev;
+ int error;
+ int i, j;
+ int field_count = 0;
+
+ if (list_empty(report_list)) {
+ hid_err(hid, "no output reports found\n");
+ return -ENODEV;
+ }
+
+ list_for_each_entry(hidinput, &hid->inputs, list) {
+
+ report_ptr = report_ptr->next;
+
+ if (report_ptr == report_list) {
+ hid_err(hid, "required output report is missing\n");
+ return -ENODEV;
+ }
+
+ report = list_entry(report_ptr, struct hid_report, list);
+ if (report->maxfield < 1) {
+ hid_err(hid, "no fields in the report\n");
+ return -ENODEV;
+ }
+
+ for (i = 0; i < report->maxfield; i++) {
+ for (j = 0; j < report->field[i]->report_count; j++) {
+ report->field[i]->value[j] = 0x00;
+ field_count++;
+ }
+ }
+
+ if (field_count < 4) {
+ hid_err(hid, "not enough fields in the report: %d\n",
+ field_count);
+ return -ENODEV;
+ }
+
+ betopff = kzalloc(sizeof(*betopff), GFP_KERNEL);
+ if (!betopff)
+ return -ENOMEM;
+
+ dev = hidinput->input;
+ set_bit(FF_RUMBLE, dev->ffbit);
+
+ error = input_ff_create_memless(dev, betopff, hid_betopff_play);
+ if (error) {
+ kfree(betopff);
+ return error;
+ }
+
+ betopff->report = report;
+ hid_hw_request(hid, betopff->report, HID_REQ_SET_REPORT);
+ }
+
+ hid_info(hid, "Force feedback for betop devices by huangbo <huangbobupt@163.com>\n");
+
+ return 0;
+}
+
+static int betop_probe(struct hid_device *hdev, const struct hid_device_id *id)
+{
+ int ret;
+
+ if (id->driver_data)
+ hdev->quirks |= HID_QUIRK_MULTI_INPUT;
+
+ ret = hid_parse(hdev);
+ if (ret) {
+ hid_err(hdev, "parse failed\n");
+ goto err;
+ }
+
+ ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT & ~HID_CONNECT_FF);
+ if (ret) {
+ hid_err(hdev, "hw start failed\n");
+ goto err;
+ }
+
+ betopff_init(hdev);
+
+ return 0;
+err:
+ return ret;
+}
+
+static const struct hid_device_id betop_devices[] = {
+ { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185PC, 0x5506) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185BFM, 0x2208) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185V2PC, 0x1850) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185V2BFM, 0x5500) },
+ { }
+};
+MODULE_DEVICE_TABLE(hid, betop_devices);
+
+static struct hid_driver betop_driver = {
+ .name = "betop",
+ .id_table = betop_devices,
+ .probe = betop_probe,
+};
+module_hid_driver(betop_driver);
+
+MODULE_LICENSE("GPL");
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index a622590..5ae554e 100755
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1820,6 +1820,10 @@ static const struct hid_device_id hid_have_special_driver[] = {
{ HID_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS, 0x0005) },
{ HID_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS, 0x0030) },
{ HID_USB_DEVICE(USB_VENDOR_ID_ZYDACRON, USB_DEVICE_ID_ZYDACRON_REMOTE_CONTROL) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185PC, 0x5506) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185BFM, 0x2208) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185V2PC, 0x1850) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185V2BFM, 0x5500) },
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_BT) },
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_NINTENDO, USB_DEVICE_ID_NINTENDO_WIIMOTE) },
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 161ee89..dce26bb 100755
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -907,6 +907,11 @@
#define USB_VENDOR_ID_ZYDACRON 0x13EC
#define USB_DEVICE_ID_ZYDACRON_REMOTE_CONTROL 0x0006
+#define USB_VENDOR_ID_BETOP_2185PC 0x11c0
+#define USB_VENDOR_ID_BETOP_2185BFM 0x11c2
+#define USB_VENDOR_ID_BETOP_2185V2PC 0x8380
+#define USB_VENDOR_ID_BETOP_2185V2BFM 0x20bc
+
#define USB_VENDOR_ID_ZYTRONIC 0x14c8
#define USB_DEVICE_ID_ZYTRONIC_ZXY100 0x0005
--
1.7.9.5
[-- Attachment #2: 0001-HID-add-BETOP-game-controller-force-feedback-support.patch --]
[-- Type: text/x-patch, Size: 7634 bytes --]
>From ce4bd236f4fc23c7c8540d122c8ffc4327dab893 Mon Sep 17 00:00:00 2001
From: Huang Bo <huangbobupt@163.com>
Date: Wed, 26 Nov 2014 18:21:03 +0800
Subject: [PATCH] HID: add BETOP game controller force feedback support
Adds force feedback support for BETOP USB game controllers.
These devices are mass produced in China.
Signed-off-by: Huang Bo <huangbobupt@163.com>
---
drivers/hid/Kconfig | 10 +++
drivers/hid/Makefile | 1 +
drivers/hid/hid-betopff.c | 168 +++++++++++++++++++++++++++++++++++++++++++++
drivers/hid/hid-core.c | 4 ++
drivers/hid/hid-ids.h | 5 ++
5 files changed, 188 insertions(+)
create mode 100644 drivers/hid/hid-betopff.c
diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
index 4938bd3..0a8fdc5 100755
--- a/drivers/hid/Kconfig
+++ b/drivers/hid/Kconfig
@@ -201,6 +201,16 @@ config DRAGONRISE_FF
Say Y here if you want to enable force feedback support for DragonRise Inc.
game controllers.
+config HID_BETOP_FF
+ tristate "Betop Production Inc. force feedback support"
+ depends on USB_HID
+ select INPUT_FF_MEMLESS
+ ---help---
+ Say Y here if you want to enable force feedback support for devices by
+ BETOP Production Ltd.
+ Currently the following devices are known to be supported:
+ - BETOP 2185 PC & BFM MODE
+
config HID_EMS_FF
tristate "EMS Production Inc. force feedback support"
depends on HID
diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile
index 4113999..a0546ca 100755
--- a/drivers/hid/Makefile
+++ b/drivers/hid/Makefile
@@ -46,6 +46,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-dr.o
+obj-$(CONFIG_HID_BETOP_FF) += hid-betopff.o
obj-$(CONFIG_HID_EMS_FF) += hid-emsff.o
obj-$(CONFIG_HID_ELECOM) += hid-elecom.o
obj-$(CONFIG_HID_EZKEY) += hid-ezkey.o
diff --git a/drivers/hid/hid-betopff.c b/drivers/hid/hid-betopff.c
new file mode 100644
index 0000000..447d6ba
--- /dev/null
+++ b/drivers/hid/hid-betopff.c
@@ -0,0 +1,168 @@
+/*
+ * Force feedback support for Betop based devices
+ *
+ * The devices are distributed under various names and the same USB device ID
+ * can be used in both adapters and actual game controllers.
+ *
+ * 0x11C0:0x5506 "BTP2185 PC mode Joystick"
+ * - tested with BTP2185 PC Mode.
+ *
+ * 0x11c2:0x2208 "BTP2185 BFM mode Joystick"
+ * - tested with BTP2185 BFM Mode.
+ *
+ * 0x8380:0x1850 "BTP2185 V2 PC mode USB Gamepad"
+ * - tested with BTP2185 PC Mode with another version.
+ *
+ * 0x20bc:0x5500 "BTP2185 V2 BFM mode Joystick"
+ * - tested with BTP2171s.
+ * Copyright (c) 2014 Huang Bo <huangbobupt@163.com>
+ */
+
+/*
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ */
+
+
+#include <linux/input.h>
+#include <linux/slab.h>
+#include <linux/module.h>
+#include <linux/hid.h>
+
+#include "hid-ids.h"
+
+struct betopff_device {
+ struct hid_report *report;
+};
+
+static int hid_betopff_play(struct input_dev *dev, void *data,
+ struct ff_effect *effect)
+{
+ struct hid_device *hid = input_get_drvdata(dev);
+ struct betopff_device *betopff = data;
+ __u16 left, right;
+
+ left = effect->u.rumble.strong_magnitude;
+ right = effect->u.rumble.weak_magnitude;
+
+ betopff->report->field[2]->value[0] = left / 256;
+ betopff->report->field[3]->value[0] = right / 256;
+
+ hid_hw_request(hid, betopff->report, HID_REQ_SET_REPORT);
+
+ return 0;
+}
+
+static int betopff_init(struct hid_device *hid)
+{
+ struct betopff_device *betopff;
+ struct hid_report *report;
+ struct hid_input *hidinput;
+ struct list_head *report_list =
+ &hid->report_enum[HID_OUTPUT_REPORT].report_list;
+ struct list_head *report_ptr = report_list;
+ struct input_dev *dev;
+ int error;
+ int i, j;
+ int field_count = 0;
+
+ if (list_empty(report_list)) {
+ hid_err(hid, "no output reports found\n");
+ return -ENODEV;
+ }
+
+ list_for_each_entry(hidinput, &hid->inputs, list) {
+
+ report_ptr = report_ptr->next;
+
+ if (report_ptr == report_list) {
+ hid_err(hid, "required output report is missing\n");
+ return -ENODEV;
+ }
+
+ report = list_entry(report_ptr, struct hid_report, list);
+ if (report->maxfield < 1) {
+ hid_err(hid, "no fields in the report\n");
+ return -ENODEV;
+ }
+
+ for (i = 0; i < report->maxfield; i++) {
+ for (j = 0; j < report->field[i]->report_count; j++) {
+ report->field[i]->value[j] = 0x00;
+ field_count++;
+ }
+ }
+
+ if (field_count < 4) {
+ hid_err(hid, "not enough fields in the report: %d\n",
+ field_count);
+ return -ENODEV;
+ }
+
+ betopff = kzalloc(sizeof(*betopff), GFP_KERNEL);
+ if (!betopff)
+ return -ENOMEM;
+
+ dev = hidinput->input;
+ set_bit(FF_RUMBLE, dev->ffbit);
+
+ error = input_ff_create_memless(dev, betopff, hid_betopff_play);
+ if (error) {
+ kfree(betopff);
+ return error;
+ }
+
+ betopff->report = report;
+ hid_hw_request(hid, betopff->report, HID_REQ_SET_REPORT);
+ }
+
+ hid_info(hid, "Force feedback for betop devices by huangbo <huangbobupt@163.com>\n");
+
+ return 0;
+}
+
+static int betop_probe(struct hid_device *hdev, const struct hid_device_id *id)
+{
+ int ret;
+
+ if (id->driver_data)
+ hdev->quirks |= HID_QUIRK_MULTI_INPUT;
+
+ ret = hid_parse(hdev);
+ if (ret) {
+ hid_err(hdev, "parse failed\n");
+ goto err;
+ }
+
+ ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT & ~HID_CONNECT_FF);
+ if (ret) {
+ hid_err(hdev, "hw start failed\n");
+ goto err;
+ }
+
+ betopff_init(hdev);
+
+ return 0;
+err:
+ return ret;
+}
+
+static const struct hid_device_id betop_devices[] = {
+ { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185PC, 0x5506) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185BFM, 0x2208) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185V2PC, 0x1850) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185V2BFM, 0x5500) },
+ { }
+};
+MODULE_DEVICE_TABLE(hid, betop_devices);
+
+static struct hid_driver betop_driver = {
+ .name = "betop",
+ .id_table = betop_devices,
+ .probe = betop_probe,
+};
+module_hid_driver(betop_driver);
+
+MODULE_LICENSE("GPL");
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index a622590..5ae554e 100755
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1820,6 +1820,10 @@ static const struct hid_device_id hid_have_special_driver[] = {
{ HID_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS, 0x0005) },
{ HID_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS, 0x0030) },
{ HID_USB_DEVICE(USB_VENDOR_ID_ZYDACRON, USB_DEVICE_ID_ZYDACRON_REMOTE_CONTROL) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185PC, 0x5506) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185BFM, 0x2208) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185V2PC, 0x1850) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185V2BFM, 0x5500) },
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_BT) },
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_NINTENDO, USB_DEVICE_ID_NINTENDO_WIIMOTE) },
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 161ee89..dce26bb 100755
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -907,6 +907,11 @@
#define USB_VENDOR_ID_ZYDACRON 0x13EC
#define USB_DEVICE_ID_ZYDACRON_REMOTE_CONTROL 0x0006
+#define USB_VENDOR_ID_BETOP_2185PC 0x11c0
+#define USB_VENDOR_ID_BETOP_2185BFM 0x11c2
+#define USB_VENDOR_ID_BETOP_2185V2PC 0x8380
+#define USB_VENDOR_ID_BETOP_2185V2BFM 0x20bc
+
#define USB_VENDOR_ID_ZYTRONIC 0x14c8
#define USB_DEVICE_ID_ZYTRONIC_ZXY100 0x0005
--
1.7.9.5
^ permalink raw reply related
* Re: [PATCHv2 1/1] HID: add BETOP game controller force feedback support
From: Jiri Kosina @ 2014-11-26 16:22 UTC (permalink / raw)
To: Huang Bo; +Cc: linux-input, linux-kernel
In-Reply-To: <5475E0C7.9020500@163.com>
On Wed, 26 Nov 2014, Huang Bo wrote:
> On 11/26/2014 09:49 PM, Jiri Kosina wrote:
> > On Wed, 26 Nov 2014, Huang Bo wrote:
> >
> >>> It's unfortunately whitespace damaged again. If it's not possible to set
> >>> up your e-mail client not to cause whitespace damage to patches (please
> >>> see Documentation/email-clients.txt for some hints), attach the patch as
> >>> an e-mail attachment.
> >>>
> >> From: Huang Bo <huangbobupt@163.com>
> >>
> >> Adds force feedback support for BETOP USB game controllers.
> >> These devices are mass produced in China.
> > Alright, so you apparently wrote the code with incorrect formatting, as
> > even the version you attached doesn't have the formatting right.
> >
> > Please reformat the code according to Documentation/CodingStyle and
> > resubmit.
> >
> > Thanks,
> >
> From: Huang Bo <huangbobupt@163.com>
>
> Adds force feedback support for BETOP USB game controllers.
> These devices are mass produced in China.
The inline version is still whitespace-damaged, but the version you
attached looks good.
[ ... snip ... ]
> diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile
> index 4113999..a0546ca 100755
> --- a/drivers/hid/Makefile
> +++ b/drivers/hid/Makefile
> @@ -46,6 +46,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-dr.o
> +obj-$(CONFIG_HID_BETOP_FF) += hid-betopff.o
Please try to keep the list ordered.
[ ... snip ... ]
> +static int betopff_init(struct hid_device *hid)
> +{
> + struct betopff_device *betopff;
> + struct hid_report *report;
> + struct hid_input *hidinput;
> + struct list_head *report_list =
> + &hid->report_enum[HID_OUTPUT_REPORT].report_list;
> + struct list_head *report_ptr = report_list;
> + struct input_dev *dev;
> + int error;
> + int i, j;
> + int field_count = 0;
> +
> + if (list_empty(report_list)) {
> + hid_err(hid, "no output reports found\n");
> + return -ENODEV;
> + }
> +
> + list_for_each_entry(hidinput, &hid->inputs, list) {
> +
> + report_ptr = report_ptr->next;
> +
> + if (report_ptr == report_list) {
> + hid_err(hid, "required output report is missing\n");
> + return -ENODEV;
> + }
> +
> + report = list_entry(report_ptr, struct hid_report, list);
> + if (report->maxfield < 1) {
> + hid_err(hid, "no fields in the report\n");
> + return -ENODEV;
> + }
> +
> + for (i = 0; i < report->maxfield; i++) {
> + for (j = 0; j < report->field[i]->report_count; j++) {
> + report->field[i]->value[j] = 0x00;
> + field_count++;
It's not obvious why this is needed, so a comment before the loop would be
nice.
--
Jiri Kosina
SUSE Labs
^ permalink raw reply
* [git pull] Input updates for 3.18-rc6
From: Dmitry Torokhov @ 2014-11-26 16:45 UTC (permalink / raw)
To: Linus Torvalds
Cc: linux-kernel, linux-input, Jiri Kosina, Ulrik De Bie,
Benjamin Tissoires
Hi Linus,
Please pull from:
git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git for-linus
or
master.kernel.org:/pub/scm/linux/kernel/git/dtor/input.git for-linus
to receive updates for the input subsystem. The main change is to fix breakage
in Elantech driver introduced by the recent commit adding trackpoint reporting
to protocol v4. Now we are trusting the hardware to advertise the trackpoint
properly and do not try to decode the data as trackpoint if firmware told us
it is not present.
Changelog:
---------
Ben Sagal (1):
Input: synaptics - adjust min/max on Thinkpad E540
Dmitry Torokhov (1):
Input: elantech - trust firmware about trackpoint presence
Greg Kroah-Hartman (1):
Input: xpad - use proper endpoint type
Diffstat:
--------
drivers/input/joystick/xpad.c | 16 +++++++++++++---
drivers/input/mouse/elantech.c | 10 +---------
drivers/input/mouse/synaptics.c | 4 ++++
3 files changed, 18 insertions(+), 12 deletions(-)
Thanks.
--
Dmitry
^ permalink raw reply
* [PATCHv3 1/1] HID: add BETOP game controller force feedback support
From: Huang Bo @ 2014-11-27 1:46 UTC (permalink / raw)
To: Jiri Kosina; +Cc: linux-input, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 7633 bytes --]
From: Huang Bo <huangbobupt@163.com>
Adds force feedback support for BETOP USB game controllers.
These devices are mass produced in China.
Signed-off-by: Huang Bo <huangbobupt@163.com>
---
drivers/hid/Kconfig | 10 +++
drivers/hid/Makefile | 1 +
drivers/hid/hid-betopff.c | 152 +++++++++++++++++++++++++++++++++++++++++++++
drivers/hid/hid-core.c | 4 ++
drivers/hid/hid-ids.h | 5 ++
5 files changed, 172 insertions(+)
create mode 100644 drivers/hid/hid-betopff.c
diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
index 4938bd3..3b4c47d 100755
--- a/drivers/hid/Kconfig
+++ b/drivers/hid/Kconfig
@@ -146,6 +146,16 @@ config HID_BELKIN
---help---
Support for Belkin Flip KVM and Wireless keyboard.
+config HID_BETOP_FF
+ tristate "Betop Production Inc. force feedback support"
+ depends on USB_HID
+ select INPUT_FF_MEMLESS
+ ---help---
+ Say Y here if you want to enable force feedback support for devices by
+ BETOP Production Ltd.
+ Currently the following devices are known to be supported:
+ - BETOP 2185 PC & BFM MODE
+
config HID_CHERRY
tristate "Cherry Cymotion keyboard" if EXPERT
depends on HID
diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile
index 4113999..edd4825 100755
--- a/drivers/hid/Makefile
+++ b/drivers/hid/Makefile
@@ -42,6 +42,7 @@ obj-$(CONFIG_HID_APPLE) += hid-apple.o
obj-$(CONFIG_HID_APPLEIR) += hid-appleir.o
obj-$(CONFIG_HID_AUREAL) += hid-aureal.o
obj-$(CONFIG_HID_BELKIN) += hid-belkin.o
+obj-$(CONFIG_HID_BETOP_FF) += hid-betopff.o
obj-$(CONFIG_HID_CHERRY) += hid-cherry.o
obj-$(CONFIG_HID_CHICONY) += hid-chicony.o
obj-$(CONFIG_HID_CYPRESS) += hid-cypress.o
diff --git a/drivers/hid/hid-betopff.c b/drivers/hid/hid-betopff.c
new file mode 100644
index 0000000..94fbde2
--- /dev/null
+++ b/drivers/hid/hid-betopff.c
@@ -0,0 +1,152 @@
+/*
+ * Force feedback support for Betop based devices
+ *
+ * The devices are distributed under various names and the same USB device ID
+ * can be used in both adapters and actual game controllers.
+ *
+ * 0x11c2:0x2208 "BTP2185 BFM mode Joystick"
+ * - tested with BTP2185 BFM Mode.
+ *
+ * 0x11C0:0x5506 "BTP2185 PC mode Joystick"
+ * - tested with BTP2185 PC Mode.
+ *
+ * 0x8380:0x1850 "BTP2185 V2 PC mode USB Gamepad"
+ * - tested with BTP2185 PC Mode with another version.
+ *
+ * 0x20bc:0x5500 "BTP2185 V2 BFM mode Joystick"
+ * - tested with BTP2171s.
+ * Copyright (c) 2014 Huang Bo <huangbobupt@163.com>
+ */
+
+/*
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ */
+
+
+#include <linux/input.h>
+#include <linux/slab.h>
+#include <linux/module.h>
+#include <linux/hid.h>
+
+#include "hid-ids.h"
+
+struct betopff_device {
+ struct hid_report *report;
+};
+
+static int hid_betopff_play(struct input_dev *dev, void *data,
+ struct ff_effect *effect)
+{
+ struct hid_device *hid = input_get_drvdata(dev);
+ struct betopff_device *betopff = data;
+ __u16 left, right;
+
+ left = effect->u.rumble.strong_magnitude;
+ right = effect->u.rumble.weak_magnitude;
+
+ betopff->report->field[2]->value[0] = left / 256;
+ betopff->report->field[3]->value[0] = right / 256;
+
+ hid_hw_request(hid, betopff->report, HID_REQ_SET_REPORT);
+
+ return 0;
+}
+
+static int betopff_init(struct hid_device *hid)
+{
+ struct betopff_device *betopff;
+ struct hid_report *report;
+ struct hid_input *hidinput =
+ list_first_entry(&hid->inputs, struct hid_input, list);
+ struct list_head *report_list =
+ &hid->report_enum[HID_OUTPUT_REPORT].report_list;
+ struct input_dev *dev = hidinput->input;
+ int field_count = 0;
+ int error;
+ int i, j;
+
+ if (list_empty(report_list)) {
+ hid_err(hid, "no output reports found\n");
+ return -ENODEV;
+ }
+
+ report = list_first_entry(report_list, struct hid_report, list);
+ for (i = 0; i < report->maxfield; i++) {
+ for (j = 0; j < report->field[i]->report_count; j++) {
+ report->field[i]->value[j] = 0x00;
+ field_count++;
+ }
+ }
+
+ if (field_count < 4) {
+ hid_err(hid, "not enough fields in the report: %d\n",
+ field_count);
+ return -ENODEV;
+ }
+
+ betopff = kzalloc(sizeof(*betopff), GFP_KERNEL);
+ if (!betopff)
+ return -ENOMEM;
+
+ set_bit(FF_RUMBLE, dev->ffbit);
+
+ error = input_ff_create_memless(dev, betopff, hid_betopff_play);
+ if (error) {
+ kfree(betopff);
+ return error;
+ }
+
+ betopff->report = report;
+ hid_hw_request(hid, betopff->report, HID_REQ_SET_REPORT);
+
+ hid_info(hid, "Force feedback for betop devices by huangbo <huangbobupt@163.com>\n");
+
+ return 0;
+}
+
+static int betop_probe(struct hid_device *hdev, const struct hid_device_id *id)
+{
+ int ret;
+
+ if (id->driver_data)
+ hdev->quirks |= HID_QUIRK_MULTI_INPUT;
+
+ ret = hid_parse(hdev);
+ if (ret) {
+ hid_err(hdev, "parse failed\n");
+ goto err;
+ }
+
+ ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT & ~HID_CONNECT_FF);
+ if (ret) {
+ hid_err(hdev, "hw start failed\n");
+ goto err;
+ }
+
+ betopff_init(hdev);
+
+ return 0;
+err:
+ return ret;
+}
+
+static const struct hid_device_id betop_devices[] = {
+ { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185BFM, 0x2208) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185PC, 0x5506) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185V2PC, 0x1850) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185V2BFM, 0x5500) },
+ { }
+};
+MODULE_DEVICE_TABLE(hid, betop_devices);
+
+static struct hid_driver betop_driver = {
+ .name = "betop",
+ .id_table = betop_devices,
+ .probe = betop_probe,
+};
+module_hid_driver(betop_driver);
+
+MODULE_LICENSE("GPL");
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index a622590..e64ccfc 100755
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1642,6 +1642,10 @@ static const struct hid_device_id hid_have_special_driver[] = {
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) },
{ HID_USB_DEVICE(USB_VENDOR_ID_AUREAL, USB_DEVICE_ID_AUREAL_W01RN) },
{ HID_USB_DEVICE(USB_VENDOR_ID_BELKIN, USB_DEVICE_ID_FLIP_KVM) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185BFM, 0x2208) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185PC, 0x5506) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185V2PC, 0x1850) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185V2BFM, 0x5500) },
{ HID_USB_DEVICE(USB_VENDOR_ID_BTC, USB_DEVICE_ID_BTC_EMPREX_REMOTE) },
{ HID_USB_DEVICE(USB_VENDOR_ID_BTC, USB_DEVICE_ID_BTC_EMPREX_REMOTE_2) },
{ HID_USB_DEVICE(USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION) },
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 161ee89..c432be9 100755
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -185,6 +185,11 @@
#define USB_VENDOR_ID_BERKSHIRE 0x0c98
#define USB_DEVICE_ID_BERKSHIRE_PCWD 0x1140
+#define USB_VENDOR_ID_BETOP_2185BFM 0x11c2
+#define USB_VENDOR_ID_BETOP_2185PC 0x11c0
+#define USB_VENDOR_ID_BETOP_2185V2PC 0x8380
+#define USB_VENDOR_ID_BETOP_2185V2BFM 0x20bc
+
#define USB_VENDOR_ID_BTC 0x046e
#define USB_DEVICE_ID_BTC_EMPREX_REMOTE 0x5578
#define USB_DEVICE_ID_BTC_EMPREX_REMOTE_2 0x5577
--
1.7.9.5
[-- Attachment #2: 0001-HID-add-BETOP-game-controller-force-feedback-support.patch --]
[-- Type: text/x-patch, Size: 7388 bytes --]
>From 65290060fb6a13808454b8535f3e8cf4ad7d3a01 Mon Sep 17 00:00:00 2001
From: Huang Bo <huangbobupt@163.com>
Date: Wed, 26 Nov 2014 18:21:03 +0800
Subject: [PATCH] HID: add BETOP game controller force feedback support
Adds force feedback support for BETOP USB game controllers.
These devices are mass produced in China.
Signed-off-by: Huang Bo <huangbobupt@163.com>
---
drivers/hid/Kconfig | 10 +++
drivers/hid/Makefile | 1 +
drivers/hid/hid-betopff.c | 152 +++++++++++++++++++++++++++++++++++++++++++++
drivers/hid/hid-core.c | 4 ++
drivers/hid/hid-ids.h | 5 ++
5 files changed, 172 insertions(+)
create mode 100644 drivers/hid/hid-betopff.c
diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
index 4938bd3..3b4c47d 100755
--- a/drivers/hid/Kconfig
+++ b/drivers/hid/Kconfig
@@ -146,6 +146,16 @@ config HID_BELKIN
---help---
Support for Belkin Flip KVM and Wireless keyboard.
+config HID_BETOP_FF
+ tristate "Betop Production Inc. force feedback support"
+ depends on USB_HID
+ select INPUT_FF_MEMLESS
+ ---help---
+ Say Y here if you want to enable force feedback support for devices by
+ BETOP Production Ltd.
+ Currently the following devices are known to be supported:
+ - BETOP 2185 PC & BFM MODE
+
config HID_CHERRY
tristate "Cherry Cymotion keyboard" if EXPERT
depends on HID
diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile
index 4113999..edd4825 100755
--- a/drivers/hid/Makefile
+++ b/drivers/hid/Makefile
@@ -42,6 +42,7 @@ obj-$(CONFIG_HID_APPLE) += hid-apple.o
obj-$(CONFIG_HID_APPLEIR) += hid-appleir.o
obj-$(CONFIG_HID_AUREAL) += hid-aureal.o
obj-$(CONFIG_HID_BELKIN) += hid-belkin.o
+obj-$(CONFIG_HID_BETOP_FF) += hid-betopff.o
obj-$(CONFIG_HID_CHERRY) += hid-cherry.o
obj-$(CONFIG_HID_CHICONY) += hid-chicony.o
obj-$(CONFIG_HID_CYPRESS) += hid-cypress.o
diff --git a/drivers/hid/hid-betopff.c b/drivers/hid/hid-betopff.c
new file mode 100644
index 0000000..94fbde2
--- /dev/null
+++ b/drivers/hid/hid-betopff.c
@@ -0,0 +1,152 @@
+/*
+ * Force feedback support for Betop based devices
+ *
+ * The devices are distributed under various names and the same USB device ID
+ * can be used in both adapters and actual game controllers.
+ *
+ * 0x11c2:0x2208 "BTP2185 BFM mode Joystick"
+ * - tested with BTP2185 BFM Mode.
+ *
+ * 0x11C0:0x5506 "BTP2185 PC mode Joystick"
+ * - tested with BTP2185 PC Mode.
+ *
+ * 0x8380:0x1850 "BTP2185 V2 PC mode USB Gamepad"
+ * - tested with BTP2185 PC Mode with another version.
+ *
+ * 0x20bc:0x5500 "BTP2185 V2 BFM mode Joystick"
+ * - tested with BTP2171s.
+ * Copyright (c) 2014 Huang Bo <huangbobupt@163.com>
+ */
+
+/*
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ */
+
+
+#include <linux/input.h>
+#include <linux/slab.h>
+#include <linux/module.h>
+#include <linux/hid.h>
+
+#include "hid-ids.h"
+
+struct betopff_device {
+ struct hid_report *report;
+};
+
+static int hid_betopff_play(struct input_dev *dev, void *data,
+ struct ff_effect *effect)
+{
+ struct hid_device *hid = input_get_drvdata(dev);
+ struct betopff_device *betopff = data;
+ __u16 left, right;
+
+ left = effect->u.rumble.strong_magnitude;
+ right = effect->u.rumble.weak_magnitude;
+
+ betopff->report->field[2]->value[0] = left / 256;
+ betopff->report->field[3]->value[0] = right / 256;
+
+ hid_hw_request(hid, betopff->report, HID_REQ_SET_REPORT);
+
+ return 0;
+}
+
+static int betopff_init(struct hid_device *hid)
+{
+ struct betopff_device *betopff;
+ struct hid_report *report;
+ struct hid_input *hidinput =
+ list_first_entry(&hid->inputs, struct hid_input, list);
+ struct list_head *report_list =
+ &hid->report_enum[HID_OUTPUT_REPORT].report_list;
+ struct input_dev *dev = hidinput->input;
+ int field_count = 0;
+ int error;
+ int i, j;
+
+ if (list_empty(report_list)) {
+ hid_err(hid, "no output reports found\n");
+ return -ENODEV;
+ }
+
+ report = list_first_entry(report_list, struct hid_report, list);
+ for (i = 0; i < report->maxfield; i++) {
+ for (j = 0; j < report->field[i]->report_count; j++) {
+ report->field[i]->value[j] = 0x00;
+ field_count++;
+ }
+ }
+
+ if (field_count < 4) {
+ hid_err(hid, "not enough fields in the report: %d\n",
+ field_count);
+ return -ENODEV;
+ }
+
+ betopff = kzalloc(sizeof(*betopff), GFP_KERNEL);
+ if (!betopff)
+ return -ENOMEM;
+
+ set_bit(FF_RUMBLE, dev->ffbit);
+
+ error = input_ff_create_memless(dev, betopff, hid_betopff_play);
+ if (error) {
+ kfree(betopff);
+ return error;
+ }
+
+ betopff->report = report;
+ hid_hw_request(hid, betopff->report, HID_REQ_SET_REPORT);
+
+ hid_info(hid, "Force feedback for betop devices by huangbo <huangbobupt@163.com>\n");
+
+ return 0;
+}
+
+static int betop_probe(struct hid_device *hdev, const struct hid_device_id *id)
+{
+ int ret;
+
+ if (id->driver_data)
+ hdev->quirks |= HID_QUIRK_MULTI_INPUT;
+
+ ret = hid_parse(hdev);
+ if (ret) {
+ hid_err(hdev, "parse failed\n");
+ goto err;
+ }
+
+ ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT & ~HID_CONNECT_FF);
+ if (ret) {
+ hid_err(hdev, "hw start failed\n");
+ goto err;
+ }
+
+ betopff_init(hdev);
+
+ return 0;
+err:
+ return ret;
+}
+
+static const struct hid_device_id betop_devices[] = {
+ { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185BFM, 0x2208) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185PC, 0x5506) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185V2PC, 0x1850) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185V2BFM, 0x5500) },
+ { }
+};
+MODULE_DEVICE_TABLE(hid, betop_devices);
+
+static struct hid_driver betop_driver = {
+ .name = "betop",
+ .id_table = betop_devices,
+ .probe = betop_probe,
+};
+module_hid_driver(betop_driver);
+
+MODULE_LICENSE("GPL");
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index a622590..e64ccfc 100755
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1642,6 +1642,10 @@ static const struct hid_device_id hid_have_special_driver[] = {
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) },
{ HID_USB_DEVICE(USB_VENDOR_ID_AUREAL, USB_DEVICE_ID_AUREAL_W01RN) },
{ HID_USB_DEVICE(USB_VENDOR_ID_BELKIN, USB_DEVICE_ID_FLIP_KVM) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185BFM, 0x2208) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185PC, 0x5506) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185V2PC, 0x1850) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185V2BFM, 0x5500) },
{ HID_USB_DEVICE(USB_VENDOR_ID_BTC, USB_DEVICE_ID_BTC_EMPREX_REMOTE) },
{ HID_USB_DEVICE(USB_VENDOR_ID_BTC, USB_DEVICE_ID_BTC_EMPREX_REMOTE_2) },
{ HID_USB_DEVICE(USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION) },
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 161ee89..c432be9 100755
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -185,6 +185,11 @@
#define USB_VENDOR_ID_BERKSHIRE 0x0c98
#define USB_DEVICE_ID_BERKSHIRE_PCWD 0x1140
+#define USB_VENDOR_ID_BETOP_2185BFM 0x11c2
+#define USB_VENDOR_ID_BETOP_2185PC 0x11c0
+#define USB_VENDOR_ID_BETOP_2185V2PC 0x8380
+#define USB_VENDOR_ID_BETOP_2185V2BFM 0x20bc
+
#define USB_VENDOR_ID_BTC 0x046e
#define USB_DEVICE_ID_BTC_EMPREX_REMOTE 0x5578
#define USB_DEVICE_ID_BTC_EMPREX_REMOTE_2 0x5577
--
1.7.9.5
^ permalink raw reply related
* Re: [PATCH v4 0/6] Touchscreen performance related fixes
From: Vignesh R @ 2014-11-27 4:29 UTC (permalink / raw)
To: Sebastian Andrzej Siewior
Cc: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
Benoit Cousson, Tony Lindgren, Russell King, Jonathan Cameron,
Hartmut Knaack, richardcochran-Re5JQEeQqe8AvxtiuMwx3w,
Dmitry Torokhov, Lee Jones, Lars-Peter Clausen, Peter Meerwald,
Samuel Ortiz, Felipe Balbi, Brad Griffis, Sanjeev Sharma,
Paul Gortmaker, Jan Kardell, devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-omap-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <547325FA.6020004-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
On Monday 24 November 2014 06:05 PM, Sebastian Andrzej Siewior wrote:
> On 11/24/2014 01:16 PM, Vignesh R wrote:
>
>> I have tried running both IIO and TSC at the same time. But I have never
>> seen WARN_ON() even after running for close to 30 min. Can you send me
>> the exact script, so that it will be easy to reproduce?
>
> Sure thing.
> - one shell
> evtest /dev/input/event2
> - second shell
> ./iio-test.sh
> with:
>
> |#!/bin/sh
> |
> |while [ 1 = 1 ]
> |do
> | cat /sys/bus/iio/devices/iio\:device0/in_voltage4_raw
> |done
>
>
> the kernel config: https://breakpoint.cc/am335x-config
>
I was able to reproduce this issue. When ADC hits WARN_ON(), the TSC
steps should be disabled. But, in this case, TSC is sampling the first Y
co-ordinate and all TSC steps are enabled.
REG_SE: 0x1ffc1
ADC_STAT: 0x24
Any idea why this may be happening?
Regards
Vignesh
^ permalink raw reply
* Re: [PATCHv3 1/1] HID: add BETOP game controller force feedback support
From: Jiri Kosina @ 2014-11-27 9:05 UTC (permalink / raw)
To: Huang Bo; +Cc: linux-input, linux-kernel
In-Reply-To: <54768284.4060201@163.com>
On Thu, 27 Nov 2014, Huang Bo wrote:
> From: Huang Bo <huangbobupt@163.com>
>
> Adds force feedback support for BETOP USB game controllers.
> These devices are mass produced in China.
Thanks. We are almost there, except ...
[ ... snip ... ]
> +static int betopff_init(struct hid_device *hid)
> +{
> + struct betopff_device *betopff;
> + struct hid_report *report;
> + struct hid_input *hidinput =
> + list_first_entry(&hid->inputs, struct hid_input, list);
> + struct list_head *report_list =
> + &hid->report_enum[HID_OUTPUT_REPORT].report_list;
> + struct input_dev *dev = hidinput->input;
> + int field_count = 0;
> + int error;
> + int i, j;
> +
> + if (list_empty(report_list)) {
> + hid_err(hid, "no output reports found\n");
> + return -ENODEV;
> + }
> +
> + report = list_first_entry(report_list, struct hid_report, list);
> + for (i = 0; i < report->maxfield; i++) {
> + for (j = 0; j < report->field[i]->report_count; j++) {
> + report->field[i]->value[j] = 0x00;
I asked for a comment to be added here why you are zeroing those out.
Thanks,
--
Jiri Kosina
SUSE Labs
^ permalink raw reply
* [PATCH 2/2] Input: amikbd - Allocate temporary keymap buffer dynamically
From: Geert Uytterhoeven @ 2014-11-27 9:42 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: linux-input, linux-m68k, Geert Uytterhoeven
In-Reply-To: <1417081340-2989-1-git-send-email-geert@linux-m68k.org>
Allocate the temporary buffer needed for initialization of the console
keyboard maps dynamically instead of statically, to reduce kernel size.
add/remove: 0/1 grow/shrink: 1/1 up/down: 12/-518 (-506)
function old new delta
amikbd_probe 358 370 +12
vermagic 63 57 -6
temp_map 512 - -512
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
drivers/input/keyboard/amikbd.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/drivers/input/keyboard/amikbd.c b/drivers/input/keyboard/amikbd.c
index 4f81e65d9e35cb7d..fc98c5d10768cd2c 100644
--- a/drivers/input/keyboard/amikbd.c
+++ b/drivers/input/keyboard/amikbd.c
@@ -36,6 +36,7 @@
#include <linux/interrupt.h>
#include <linux/keyboard.h>
#include <linux/platform_device.h>
+#include <linux/slab.h>
#include <asm/amigaints.h>
#include <asm/amigahw.h>
@@ -147,13 +148,18 @@ static unsigned char amikbd_keycode[0x78] __initdata = {
static void __init amikbd_init_console_keymaps(void)
{
+ unsigned short *temp_map;
+ size_t temp_map_size = NR_KEYS * sizeof(*temp_map);
int i, j;
+ temp_map = kmalloc(temp_map_size, GFP_KERNEL);
+ if (!temp_map)
+ return;
+
for (i = 0; i < MAX_NR_KEYMAPS; i++) {
- static u_short temp_map[NR_KEYS] __initdata;
if (!key_maps[i])
continue;
- memset(temp_map, 0, sizeof(temp_map));
+ memset(temp_map, 0, temp_map_size);
for (j = 0; j < 0x78; j++) {
if (!amikbd_keycode[j])
continue;
@@ -163,8 +169,10 @@ static void __init amikbd_init_console_keymaps(void)
if (!temp_map[j])
temp_map[j] = 0xf200;
}
- memcpy(key_maps[i], temp_map, sizeof(temp_map));
+ memcpy(key_maps[i], temp_map, temp_map_size);
}
+
+ kfree(temp_map);
}
#else /* !CONFIG_HW_CONSOLE */
static inline void amikbd_init_console_keymaps(void) {}
--
1.9.1
^ permalink raw reply related
* [PATCH 1/2] Input: amikbd - Fix build if !CONFIG_HW_CONSOLE
From: Geert Uytterhoeven @ 2014-11-27 9:42 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: linux-input, linux-m68k, Geert Uytterhoeven
If CONFIG_HW_CONSOLE is not set:
drivers/built-in.o: In function `amikbd_probe':
amikbd.c:(.init.text+0x3e4e): undefined reference to `key_maps'
amikbd.c:(.init.text+0x3dd4): undefined reference to `key_maps'
To fix this, extract the initialization of the console keyboard maps
into amikbd_init_console_keymaps(), protected by #ifdef
CONFIG_HW_CONSOLE.
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
Discovered during randconfig builds.
---
drivers/input/keyboard/amikbd.c | 46 ++++++++++++++++++++++++++---------------
1 file changed, 29 insertions(+), 17 deletions(-)
diff --git a/drivers/input/keyboard/amikbd.c b/drivers/input/keyboard/amikbd.c
index 096d6067ae1f890f..4f81e65d9e35cb7d 100644
--- a/drivers/input/keyboard/amikbd.c
+++ b/drivers/input/keyboard/amikbd.c
@@ -45,6 +45,7 @@ MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
MODULE_DESCRIPTION("Amiga keyboard driver");
MODULE_LICENSE("GPL");
+#ifdef CONFIG_HW_CONSOLE
static unsigned char amikbd_keycode[0x78] __initdata = {
[0] = KEY_GRAVE,
[1] = KEY_1,
@@ -144,6 +145,31 @@ static unsigned char amikbd_keycode[0x78] __initdata = {
[103] = KEY_RIGHTMETA
};
+static void __init amikbd_init_console_keymaps(void)
+{
+ int i, j;
+
+ for (i = 0; i < MAX_NR_KEYMAPS; i++) {
+ static u_short temp_map[NR_KEYS] __initdata;
+ if (!key_maps[i])
+ continue;
+ memset(temp_map, 0, sizeof(temp_map));
+ for (j = 0; j < 0x78; j++) {
+ if (!amikbd_keycode[j])
+ continue;
+ temp_map[j] = key_maps[i][amikbd_keycode[j]];
+ }
+ for (j = 0; j < NR_KEYS; j++) {
+ if (!temp_map[j])
+ temp_map[j] = 0xf200;
+ }
+ memcpy(key_maps[i], temp_map, sizeof(temp_map));
+ }
+}
+#else /* !CONFIG_HW_CONSOLE */
+static inline void amikbd_init_console_keymaps(void) {}
+#endif /* !CONFIG_HW_CONSOLE */
+
static const char *amikbd_messages[8] = {
[0] = KERN_ALERT "amikbd: Ctrl-Amiga-Amiga reset warning!!\n",
[1] = KERN_WARNING "amikbd: keyboard lost sync\n",
@@ -186,7 +212,7 @@ static irqreturn_t amikbd_interrupt(int irq, void *data)
static int __init amikbd_probe(struct platform_device *pdev)
{
struct input_dev *dev;
- int i, j, err;
+ int i, err;
dev = input_allocate_device();
if (!dev) {
@@ -207,22 +233,8 @@ static int __init amikbd_probe(struct platform_device *pdev)
for (i = 0; i < 0x78; i++)
set_bit(i, dev->keybit);
- for (i = 0; i < MAX_NR_KEYMAPS; i++) {
- static u_short temp_map[NR_KEYS] __initdata;
- if (!key_maps[i])
- continue;
- memset(temp_map, 0, sizeof(temp_map));
- for (j = 0; j < 0x78; j++) {
- if (!amikbd_keycode[j])
- continue;
- temp_map[j] = key_maps[i][amikbd_keycode[j]];
- }
- for (j = 0; j < NR_KEYS; j++) {
- if (!temp_map[j])
- temp_map[j] = 0xf200;
- }
- memcpy(key_maps[i], temp_map, sizeof(temp_map));
- }
+ amikbd_init_console_keymaps();
+
ciaa.cra &= ~0x41; /* serial data in, turn off TA */
err = request_irq(IRQ_AMIGA_CIAA_SP, amikbd_interrupt, 0, "amikbd",
dev);
--
1.9.1
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox