Incorporate Dmitry's comments

legacy
Markus Koch 2019-07-21 12:51:16 +02:00
parent a701882fd5
commit 4ef01c2ad4
3 changed files with 20 additions and 32 deletions

2
.gitmodules vendored
View File

@ -1,3 +1,3 @@
[submodule "linuxconsole"] [submodule "linuxconsole"]
path = linuxconsole path = linuxconsole
url = https://git.code.sf.net/p/linuxconsole/code url = git://git.code.sf.net/p/linuxconsole/code

View File

@ -1,22 +1,8 @@
// SPDX-License-Identifier: GPL-2.0 // SPDX-License-Identifier: GPL-2.0
/* /*
* FS-iA6B iBus RC receiver driver
* *
* FS-iA6B iBus RC receiver kernel driver * Copyright (C) 2018 - 2019 Markus Koch <markus@notsyncing.net>
* Copyright (C) 2018 - 2019 Markus Koch <markus@notsyncing.net>
*
* 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.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program.
*
*/ */
/* /*
@ -30,14 +16,17 @@
* *
*/ */
#include <linux/device.h>
#include <linux/input.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/input.h>
#include <linux/serio.h> #include <linux/serio.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/device.h> #include <linux/types.h>
#define SERIO_FSIA6B 100 /* TODO: This should be moved to the serio header */ #ifndef SERIO_FSIA6B
#define SERIO_FSIA6B 0x42
#endif
#define DRIVER_DESC "FS-iA6B iBus RC receiver" #define DRIVER_DESC "FS-iA6B iBus RC receiver"
@ -68,8 +57,8 @@ struct ibus_packet {
enum ibus_state state; enum ibus_state state;
int offset; int offset;
uint16_t ibuf; u16 ibuf;
uint16_t channel[IBUS_SERVO_COUNT]; u16 channel[IBUS_SERVO_COUNT];
}; };
struct fsia6b { struct fsia6b {
@ -150,9 +139,9 @@ static int fsia6b_serio_connect(struct serio *serio, struct serio_driver *drv)
struct input_dev *input_dev; struct input_dev *input_dev;
int err; int err;
int i, j; int i, j;
int sw_id = BTN_0; int sw_id = 0;
fsia6b = kzalloc(sizeof(struct fsia6b), GFP_KERNEL); fsia6b = kzalloc(sizeof(*fsia6b), GFP_KERNEL);
if (!fsia6b) if (!fsia6b)
return -ENOMEM; return -ENOMEM;
@ -168,9 +157,10 @@ static int fsia6b_serio_connect(struct serio *serio, struct serio_driver *drv)
input_dev = input_allocate_device(); input_dev = input_allocate_device();
err = -ENODEV; if (!input_dev) {
if (!input_dev) err = -ENOMEM;
goto fail2; goto fail2;
}
fsia6b->dev = input_dev; fsia6b->dev = input_dev;
snprintf(fsia6b->phys, sizeof(fsia6b->phys), "%s/input0", serio->phys); snprintf(fsia6b->phys, sizeof(fsia6b->phys), "%s/input0", serio->phys);
@ -183,8 +173,6 @@ static int fsia6b_serio_connect(struct serio *serio, struct serio_driver *drv)
input_dev->id.version = 0x0100; input_dev->id.version = 0x0100;
input_dev->dev.parent = &serio->dev; input_dev->dev.parent = &serio->dev;
input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
for (i = 0; i < IBUS_SERVO_COUNT; ++i) { for (i = 0; i < IBUS_SERVO_COUNT; ++i) {
input_set_abs_params(input_dev, fsia6b_axes[i], input_set_abs_params(input_dev, fsia6b_axes[i],
1000, 2000, 2, 2); 1000, 2000, 2, 2);
@ -201,9 +189,9 @@ static int fsia6b_serio_connect(struct serio *serio, struct serio_driver *drv)
goto fail3; goto fail3;
} }
for (j = '1'; j <= switch_config[i]; ++j) { for (j = '1'; j <= switch_config[i]; ++j) {
input_dev->keybit[BIT_WORD(BTN_0)] |= input_set_capability(input_dev, EV_KEY, BTN_0 + sw_id);
BIT_MASK(sw_id++); sw_id++;
} }
} }

View File

@ -17,7 +17,7 @@ index 53528551..dd3112d6 100644
SERIO_WACOM_IV, 0x00, 0x00, 0, wacom_iv_init }, SERIO_WACOM_IV, 0x00, 0x00, 0, wacom_iv_init },
+{ "--fsia6b", "-fsia6b", "FS-iA6B RC Receiver", +{ "--fsia6b", "-fsia6b", "FS-iA6B RC Receiver",
+ B115200, CS8, + B115200, CS8,
+ 100, 0x00, 0x00, 0, NULL }, + 0x42, 0x00, 0x00, 0, NULL },
{ "--pulse8-cec", "-pulse8-cec", "Pulse Eight HDMI CEC dongle", { "--pulse8-cec", "-pulse8-cec", "Pulse Eight HDMI CEC dongle",
B9600, CS8, B9600, CS8,
SERIO_PULSE8_CEC, 0x00, 0x00, 0, NULL }, SERIO_PULSE8_CEC, 0x00, 0x00, 0, NULL },