Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
fa4c7c64
K
Kernel
项目概览
openeuler
/
Kernel
1 年多 前同步成功
通知
8
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
Kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
fa4c7c64
编写于
5月 24, 2022
作者:
J
Jiri Kosina
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'for-5.19/megaworld' into for-linus
上级
35b4e60e
06be0d64
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
137 addition
and
0 deletion
+137
-0
drivers/hid/Kconfig
drivers/hid/Kconfig
+8
-0
drivers/hid/Makefile
drivers/hid/Makefile
+1
-0
drivers/hid/hid-ids.h
drivers/hid/hid-ids.h
+3
-0
drivers/hid/hid-megaworld.c
drivers/hid/hid-megaworld.c
+125
-0
未找到文件。
drivers/hid/Kconfig
浏览文件 @
fa4c7c64
...
...
@@ -686,6 +686,14 @@ config HID_MAYFLASH
Say Y here if you have HJZ Mayflash PS3 game controller adapters
and want to enable force feedback support.
config HID_MEGAWORLD_FF
tristate "Mega World based game controller force feedback support"
depends on USB_HID
select INPUT_FF_MEMLESS
help
Say Y here if you have a Mega World based game controller and want
to have force feedback support for it.
config HID_REDRAGON
tristate "Redragon keyboards"
depends on HID
...
...
drivers/hid/Makefile
浏览文件 @
fa4c7c64
...
...
@@ -76,6 +76,7 @@ obj-$(CONFIG_HID_MAGICMOUSE) += hid-magicmouse.o
obj-$(CONFIG_HID_MALTRON)
+=
hid-maltron.o
obj-$(CONFIG_HID_MCP2221)
+=
hid-mcp2221.o
obj-$(CONFIG_HID_MAYFLASH)
+=
hid-mf.o
obj-$(CONFIG_HID_MEGAWORLD_FF)
+=
hid-megaworld.o
obj-$(CONFIG_HID_MICROSOFT)
+=
hid-microsoft.o
obj-$(CONFIG_HID_MONTEREY)
+=
hid-monterey.o
obj-$(CONFIG_HID_MULTITOUCH)
+=
hid-multitouch.o
...
...
drivers/hid/hid-ids.h
浏览文件 @
fa4c7c64
...
...
@@ -871,6 +871,9 @@
#define USB_VENDOR_ID_MCS 0x16d0
#define USB_DEVICE_ID_MCS_GAMEPADBLOCK 0x0bcc
#define USB_VENDOR_MEGAWORLD 0x07b5
#define USB_DEVICE_ID_MEGAWORLD_GAMEPAD 0x0312
#define USB_VENDOR_ID_MGE 0x0463
#define USB_DEVICE_ID_MGE_UPS 0xffff
#define USB_DEVICE_ID_MGE_UPS1 0x0001
...
...
drivers/hid/hid-megaworld.c
0 → 100644
浏览文件 @
fa4c7c64
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Vibration support for Mega World controllers
*
* Copyright 2022 Frank Zago
*
* Derived from hid-zpff.c:
* Copyright (c) 2005, 2006 Anssi Hannula <anssi.hannula@gmail.com>
*/
#include <linux/hid.h>
#include <linux/input.h>
#include <linux/module.h>
#include <linux/slab.h>
#include "hid-ids.h"
struct
mwctrl_device
{
struct
hid_report
*
report
;
s32
*
weak
;
s32
*
strong
;
};
static
int
mwctrl_play
(
struct
input_dev
*
dev
,
void
*
data
,
struct
ff_effect
*
effect
)
{
struct
hid_device
*
hid
=
input_get_drvdata
(
dev
);
struct
mwctrl_device
*
mwctrl
=
data
;
*
mwctrl
->
strong
=
effect
->
u
.
rumble
.
strong_magnitude
>>
8
;
*
mwctrl
->
weak
=
effect
->
u
.
rumble
.
weak_magnitude
>>
8
;
hid_hw_request
(
hid
,
mwctrl
->
report
,
HID_REQ_SET_REPORT
);
return
0
;
}
static
int
mwctrl_init
(
struct
hid_device
*
hid
)
{
struct
mwctrl_device
*
mwctrl
;
struct
hid_report
*
report
;
struct
hid_input
*
hidinput
;
struct
input_dev
*
dev
;
int
error
;
int
i
;
if
(
list_empty
(
&
hid
->
inputs
))
{
hid_err
(
hid
,
"no inputs found
\n
"
);
return
-
ENODEV
;
}
hidinput
=
list_entry
(
hid
->
inputs
.
next
,
struct
hid_input
,
list
);
dev
=
hidinput
->
input
;
for
(
i
=
0
;
i
<
4
;
i
++
)
{
report
=
hid_validate_values
(
hid
,
HID_OUTPUT_REPORT
,
0
,
i
,
1
);
if
(
!
report
)
return
-
ENODEV
;
}
mwctrl
=
kzalloc
(
sizeof
(
struct
mwctrl_device
),
GFP_KERNEL
);
if
(
!
mwctrl
)
return
-
ENOMEM
;
set_bit
(
FF_RUMBLE
,
dev
->
ffbit
);
error
=
input_ff_create_memless
(
dev
,
mwctrl
,
mwctrl_play
);
if
(
error
)
{
kfree
(
mwctrl
);
return
error
;
}
mwctrl
->
report
=
report
;
/* Field 0 is always 2, and field 1 is always 0. The original
* windows driver has a 5 bytes command, where the 5th byte is
* a repeat of the 3rd byte, however the device has only 4
* fields. It could be a bug in the driver, or there is a
* different device that needs it.
*/
report
->
field
[
0
]
->
value
[
0
]
=
0x02
;
mwctrl
->
strong
=
&
report
->
field
[
2
]
->
value
[
0
];
mwctrl
->
weak
=
&
report
->
field
[
3
]
->
value
[
0
];
return
0
;
}
static
int
mwctrl_probe
(
struct
hid_device
*
hdev
,
const
struct
hid_device_id
*
id
)
{
int
ret
;
ret
=
hid_parse
(
hdev
);
if
(
ret
)
{
hid_err
(
hdev
,
"parse failed
\n
"
);
return
ret
;
}
ret
=
hid_hw_start
(
hdev
,
HID_CONNECT_DEFAULT
&
~
HID_CONNECT_FF
);
if
(
ret
)
{
hid_err
(
hdev
,
"hw start failed
\n
"
);
return
ret
;
}
ret
=
mwctrl_init
(
hdev
);
if
(
ret
)
hid_hw_stop
(
hdev
);
return
ret
;
}
static
const
struct
hid_device_id
mwctrl_devices
[]
=
{
{
HID_USB_DEVICE
(
USB_VENDOR_MEGAWORLD
,
USB_DEVICE_ID_MEGAWORLD_GAMEPAD
)
},
{
}
};
MODULE_DEVICE_TABLE
(
hid
,
mwctrl_devices
);
static
struct
hid_driver
mwctrl_driver
=
{
.
name
=
"megaworld"
,
.
id_table
=
mwctrl_devices
,
.
probe
=
mwctrl_probe
,
};
module_hid_driver
(
mwctrl_driver
);
MODULE_LICENSE
(
"GPL"
);
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录