Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
d463fd44
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看板
提交
d463fd44
编写于
4月 05, 2018
作者:
J
Jiri Kosina
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'for-4.17/google-hammer' into for-linus
Support for Google Hammer device.
上级
a9ef00ae
7d3d8840
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
148 addition
and
0 deletion
+148
-0
drivers/hid/Kconfig
drivers/hid/Kconfig
+6
-0
drivers/hid/Makefile
drivers/hid/Makefile
+1
-0
drivers/hid/hid-google-hammer.c
drivers/hid/hid-google-hammer.c
+138
-0
drivers/hid/hid-ids.h
drivers/hid/hid-ids.h
+3
-0
未找到文件。
drivers/hid/Kconfig
浏览文件 @
d463fd44
...
...
@@ -331,6 +331,12 @@ config HOLTEK_FF
Say Y here if you have a Holtek On Line Grip based game controller
and want to have force feedback support for it.
config HID_GOOGLE_HAMMER
tristate "Google Hammer Keyboard"
depends on USB_HID && LEDS_CLASS
---help---
Say Y here if you have a Google Hammer device.
config HID_GT683R
tristate "MSI GT68xR LED support"
depends on LEDS_CLASS && USB_HID
...
...
drivers/hid/Makefile
浏览文件 @
d463fd44
...
...
@@ -44,6 +44,7 @@ obj-$(CONFIG_HID_ELO) += hid-elo.o
obj-$(CONFIG_HID_EZKEY)
+=
hid-ezkey.o
obj-$(CONFIG_HID_GEMBIRD)
+=
hid-gembird.o
obj-$(CONFIG_HID_GFRM)
+=
hid-gfrm.o
obj-$(CONFIG_HID_GOOGLE_HAMMER)
+=
hid-google-hammer.o
obj-$(CONFIG_HID_GT683R)
+=
hid-gt683r.o
obj-$(CONFIG_HID_GYRATION)
+=
hid-gyration.o
obj-$(CONFIG_HID_HOLTEK)
+=
hid-holtek-kbd.o
...
...
drivers/hid/hid-google-hammer.c
0 → 100644
浏览文件 @
d463fd44
// SPDX-License-Identifier: GPL-2.0+
/*
* HID driver for Google Hammer device.
*
* Copyright (c) 2017 Google Inc.
* Author: Wei-Ning Huang <wnhuang@google.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/hid.h>
#include <linux/leds.h>
#include <linux/module.h>
#include "hid-ids.h"
#define MAX_BRIGHTNESS 100
/* HID usage for keyboard backlight (Alphanumeric display brightness) */
#define HID_AD_BRIGHTNESS 0x00140046
struct
hammer_kbd_leds
{
struct
led_classdev
cdev
;
struct
hid_device
*
hdev
;
u8
buf
[
2
]
____cacheline_aligned
;
};
static
int
hammer_kbd_brightness_set_blocking
(
struct
led_classdev
*
cdev
,
enum
led_brightness
br
)
{
struct
hammer_kbd_leds
*
led
=
container_of
(
cdev
,
struct
hammer_kbd_leds
,
cdev
);
int
ret
;
led
->
buf
[
0
]
=
0
;
led
->
buf
[
1
]
=
br
;
/*
* Request USB HID device to be in Full On mode, so that sending
* hardware output report and hardware raw request won't fail.
*/
ret
=
hid_hw_power
(
led
->
hdev
,
PM_HINT_FULLON
);
if
(
ret
<
0
)
{
hid_err
(
led
->
hdev
,
"failed: device not resumed %d
\n
"
,
ret
);
return
ret
;
}
ret
=
hid_hw_output_report
(
led
->
hdev
,
led
->
buf
,
sizeof
(
led
->
buf
));
if
(
ret
==
-
ENOSYS
)
ret
=
hid_hw_raw_request
(
led
->
hdev
,
0
,
led
->
buf
,
sizeof
(
led
->
buf
),
HID_OUTPUT_REPORT
,
HID_REQ_SET_REPORT
);
if
(
ret
<
0
)
hid_err
(
led
->
hdev
,
"failed to set keyboard backlight: %d
\n
"
,
ret
);
/* Request USB HID device back to Normal Mode. */
hid_hw_power
(
led
->
hdev
,
PM_HINT_NORMAL
);
return
ret
;
}
static
int
hammer_register_leds
(
struct
hid_device
*
hdev
)
{
struct
hammer_kbd_leds
*
kbd_backlight
;
kbd_backlight
=
devm_kzalloc
(
&
hdev
->
dev
,
sizeof
(
*
kbd_backlight
),
GFP_KERNEL
);
if
(
!
kbd_backlight
)
return
-
ENOMEM
;
kbd_backlight
->
hdev
=
hdev
;
kbd_backlight
->
cdev
.
name
=
"hammer::kbd_backlight"
;
kbd_backlight
->
cdev
.
max_brightness
=
MAX_BRIGHTNESS
;
kbd_backlight
->
cdev
.
brightness_set_blocking
=
hammer_kbd_brightness_set_blocking
;
kbd_backlight
->
cdev
.
flags
=
LED_HW_PLUGGABLE
;
/* Set backlight to 0% initially. */
hammer_kbd_brightness_set_blocking
(
&
kbd_backlight
->
cdev
,
0
);
return
devm_led_classdev_register
(
&
hdev
->
dev
,
&
kbd_backlight
->
cdev
);
}
static
int
hammer_input_configured
(
struct
hid_device
*
hdev
,
struct
hid_input
*
hi
)
{
struct
list_head
*
report_list
=
&
hdev
->
report_enum
[
HID_OUTPUT_REPORT
].
report_list
;
struct
hid_report
*
report
;
if
(
list_empty
(
report_list
))
return
0
;
report
=
list_first_entry
(
report_list
,
struct
hid_report
,
list
);
if
(
report
->
maxfield
==
1
&&
report
->
field
[
0
]
->
application
==
HID_GD_KEYBOARD
&&
report
->
field
[
0
]
->
maxusage
==
1
&&
report
->
field
[
0
]
->
usage
[
0
].
hid
==
HID_AD_BRIGHTNESS
)
{
int
err
=
hammer_register_leds
(
hdev
);
if
(
err
)
hid_warn
(
hdev
,
"Failed to register keyboard backlight: %d
\n
"
,
err
);
}
return
0
;
}
static
const
struct
hid_device_id
hammer_devices
[]
=
{
{
HID_DEVICE
(
BUS_USB
,
HID_GROUP_GENERIC
,
USB_VENDOR_ID_GOOGLE
,
USB_DEVICE_ID_GOOGLE_HAMMER
)
},
{
HID_DEVICE
(
BUS_USB
,
HID_GROUP_GENERIC
,
USB_VENDOR_ID_GOOGLE
,
USB_DEVICE_ID_GOOGLE_STAFF
)
},
{
HID_DEVICE
(
BUS_USB
,
HID_GROUP_GENERIC
,
USB_VENDOR_ID_GOOGLE
,
USB_DEVICE_ID_GOOGLE_WAND
)
},
{
}
};
MODULE_DEVICE_TABLE
(
hid
,
hammer_devices
);
static
struct
hid_driver
hammer_driver
=
{
.
name
=
"hammer"
,
.
id_table
=
hammer_devices
,
.
input_configured
=
hammer_input_configured
,
};
module_hid_driver
(
hammer_driver
);
MODULE_LICENSE
(
"GPL"
);
drivers/hid/hid-ids.h
浏览文件 @
d463fd44
...
...
@@ -447,7 +447,10 @@
#define USB_DEVICE_ID_GOODTOUCH_000f 0x000f
#define USB_VENDOR_ID_GOOGLE 0x18d1
#define USB_DEVICE_ID_GOOGLE_HAMMER 0x5022
#define USB_DEVICE_ID_GOOGLE_TOUCH_ROSE 0x5028
#define USB_DEVICE_ID_GOOGLE_STAFF 0x502b
#define USB_DEVICE_ID_GOOGLE_WAND 0x502d
#define USB_VENDOR_ID_GOTOP 0x08f2
#define USB_DEVICE_ID_SUPER_Q2 0x007f
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录