diff --git a/.gitmodules b/.gitmodules index 5704036..3dce571 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "linuxconsole"] path = linuxconsole - url = https://git.code.sf.net/p/linuxconsole/code + url = git://git.code.sf.net/p/linuxconsole/code diff --git a/fsia6b.c b/fsia6b.c index 8ca187b..d93f864 100644 --- a/fsia6b.c +++ b/fsia6b.c @@ -1,22 +1,8 @@ // 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 - * - * 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. - * + * Copyright (C) 2018 - 2019 Markus Koch */ /* @@ -30,14 +16,17 @@ * */ +#include +#include #include #include -#include #include #include -#include +#include -#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" @@ -68,8 +57,8 @@ struct ibus_packet { enum ibus_state state; int offset; - uint16_t ibuf; - uint16_t channel[IBUS_SERVO_COUNT]; + u16 ibuf; + u16 channel[IBUS_SERVO_COUNT]; }; struct fsia6b { @@ -150,9 +139,9 @@ static int fsia6b_serio_connect(struct serio *serio, struct serio_driver *drv) struct input_dev *input_dev; int err; 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) return -ENOMEM; @@ -168,9 +157,10 @@ static int fsia6b_serio_connect(struct serio *serio, struct serio_driver *drv) input_dev = input_allocate_device(); - err = -ENODEV; - if (!input_dev) + if (!input_dev) { + err = -ENOMEM; goto fail2; + } fsia6b->dev = input_dev; 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->dev.parent = &serio->dev; - input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); - for (i = 0; i < IBUS_SERVO_COUNT; ++i) { input_set_abs_params(input_dev, fsia6b_axes[i], 1000, 2000, 2, 2); @@ -201,9 +189,9 @@ static int fsia6b_serio_connect(struct serio *serio, struct serio_driver *drv) goto fail3; } - for (j = '1'; j <= switch_config[i]; ++j) { - input_dev->keybit[BIT_WORD(BTN_0)] |= - BIT_MASK(sw_id++); + for (j = '1'; j <= switch_config[i]; ++j) { + input_set_capability(input_dev, EV_KEY, BTN_0 + sw_id); + sw_id++; } } diff --git a/patches/linuxconsole-0001-Add-support-for-the-FS-iA6B-receiver.patch b/patches/linuxconsole-0001-Add-support-for-the-FS-iA6B-receiver.patch index de8b0fb..f29aa6b 100644 --- a/patches/linuxconsole-0001-Add-support-for-the-FS-iA6B-receiver.patch +++ b/patches/linuxconsole-0001-Add-support-for-the-FS-iA6B-receiver.patch @@ -17,7 +17,7 @@ index 53528551..dd3112d6 100644 SERIO_WACOM_IV, 0x00, 0x00, 0, wacom_iv_init }, +{ "--fsia6b", "-fsia6b", "FS-iA6B RC Receiver", + B115200, CS8, -+ 100, 0x00, 0x00, 0, NULL }, ++ 0x42, 0x00, 0x00, 0, NULL }, { "--pulse8-cec", "-pulse8-cec", "Pulse Eight HDMI CEC dongle", B9600, CS8, SERIO_PULSE8_CEC, 0x00, 0x00, 0, NULL },