Merge branch 'next' into for-linus
Prepare input updates for 4.19 merge window.
This commit is contained in:
@@ -20,10 +20,6 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Should you need to contact me, the author, you can do so either by
|
||||
* e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
|
||||
* Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
|
@@ -20,10 +20,6 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Should you need to contact me, the author, you can do so either by
|
||||
* e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
|
||||
* Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
|
||||
*/
|
||||
|
||||
#include <linux/delay.h>
|
||||
|
@@ -20,10 +20,6 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Should you need to contact me, the author, you can do so either by
|
||||
* e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
|
||||
* Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
|
||||
*/
|
||||
|
||||
#include <linux/types.h>
|
||||
|
@@ -20,10 +20,6 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Should you need to contact me, the author, you can do so either by
|
||||
* e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
|
||||
* Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
|
||||
*/
|
||||
|
||||
#include <linux/delay.h>
|
||||
|
@@ -20,10 +20,6 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Should you need to contact me, the author, you can do so either by
|
||||
* e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
|
||||
* Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
|
@@ -23,10 +23,6 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Should you need to contact me, the author, you can do so either by
|
||||
* e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
|
||||
* Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
@@ -263,6 +259,7 @@ static unsigned char db9_saturn_read_packet(struct parport *port, unsigned char
|
||||
db9_saturn_write_sub(port, type, 3, powered, 0);
|
||||
return data[0] = 0xe3;
|
||||
}
|
||||
/* else: fall through */
|
||||
default:
|
||||
return data[0];
|
||||
}
|
||||
@@ -282,11 +279,14 @@ static int db9_saturn_report(unsigned char id, unsigned char data[60], struct in
|
||||
switch (data[j]) {
|
||||
case 0x16: /* multi controller (analog 4 axis) */
|
||||
input_report_abs(dev, db9_abs[5], data[j + 6]);
|
||||
/* fall through */
|
||||
case 0x15: /* mission stick (analog 3 axis) */
|
||||
input_report_abs(dev, db9_abs[3], data[j + 4]);
|
||||
input_report_abs(dev, db9_abs[4], data[j + 5]);
|
||||
/* fall through */
|
||||
case 0x13: /* racing controller (analog 1 axis) */
|
||||
input_report_abs(dev, db9_abs[2], data[j + 3]);
|
||||
/* fall through */
|
||||
case 0x34: /* saturn keyboard (udlr ZXC ASD QE Esc) */
|
||||
case 0x02: /* digital pad (digital 2 axis + buttons) */
|
||||
input_report_abs(dev, db9_abs[0], !(data[j + 1] & 128) - !(data[j + 1] & 64));
|
||||
@@ -380,6 +380,7 @@ static void db9_timer(struct timer_list *t)
|
||||
input_report_abs(dev2, ABS_X, (data & DB9_RIGHT ? 0 : 1) - (data & DB9_LEFT ? 0 : 1));
|
||||
input_report_abs(dev2, ABS_Y, (data & DB9_DOWN ? 0 : 1) - (data & DB9_UP ? 0 : 1));
|
||||
input_report_key(dev2, BTN_TRIGGER, ~data & DB9_FIRE1);
|
||||
/* fall through */
|
||||
|
||||
case DB9_MULTI_0802:
|
||||
|
||||
|
@@ -24,10 +24,6 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Should you need to contact me, the author, you can do so either by
|
||||
* e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
|
||||
* Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
|
||||
*/
|
||||
|
||||
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||
|
@@ -20,10 +20,6 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Should you need to contact me, the author, you can do so either by
|
||||
* e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
|
||||
* Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
|
||||
*/
|
||||
|
||||
#include <linux/delay.h>
|
||||
|
@@ -20,10 +20,6 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Should you need to contact me, the author, you can do so either by
|
||||
* e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
|
||||
* Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
|
@@ -20,10 +20,6 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Should you need to contact me, the author, you can do so either by
|
||||
* e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
|
||||
* Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
|
@@ -19,10 +19,6 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Should you need to contact me, the author, you can do so either by
|
||||
* e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
|
||||
* Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
|
||||
*/
|
||||
|
||||
#include "iforce.h"
|
||||
@@ -56,7 +52,7 @@ static int make_magnitude_modifier(struct iforce* iforce,
|
||||
|
||||
iforce_send_packet(iforce, FF_CMD_MAGNITUDE, data);
|
||||
|
||||
iforce_dump_packet("magnitude: ", FF_CMD_MAGNITUDE, data);
|
||||
iforce_dump_packet(iforce, "magnitude", FF_CMD_MAGNITUDE, data);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -178,7 +174,7 @@ static int make_condition_modifier(struct iforce* iforce,
|
||||
data[9] = (100 * lsat) >> 16;
|
||||
|
||||
iforce_send_packet(iforce, FF_CMD_CONDITION, data);
|
||||
iforce_dump_packet("condition", FF_CMD_CONDITION, data);
|
||||
iforce_dump_packet(iforce, "condition", FF_CMD_CONDITION, data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@@ -19,10 +19,6 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Should you need to contact me, the author, you can do so either by
|
||||
* e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
|
||||
* Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
|
||||
*/
|
||||
|
||||
#include "iforce.h"
|
||||
@@ -33,21 +29,14 @@ MODULE_LICENSE("GPL");
|
||||
|
||||
static signed short btn_joystick[] =
|
||||
{ BTN_TRIGGER, BTN_TOP, BTN_THUMB, BTN_TOP2, BTN_BASE,
|
||||
BTN_BASE2, BTN_BASE3, BTN_BASE4, BTN_BASE5, BTN_A, BTN_B, BTN_C, -1 };
|
||||
BTN_BASE2, BTN_BASE3, BTN_BASE4, BTN_BASE5, BTN_A,
|
||||
BTN_B, BTN_C, BTN_DEAD, -1 };
|
||||
|
||||
static signed short btn_avb_pegasus[] =
|
||||
{ BTN_TRIGGER, BTN_TOP, BTN_THUMB, BTN_TOP2, BTN_BASE,
|
||||
BTN_BASE2, BTN_BASE3, BTN_BASE4, -1 };
|
||||
static signed short btn_joystick_avb[] =
|
||||
{ BTN_TRIGGER, BTN_THUMB, BTN_TOP, BTN_TOP2, BTN_BASE,
|
||||
BTN_BASE2, BTN_BASE3, BTN_BASE4, BTN_DEAD, -1 };
|
||||
|
||||
static signed short btn_wheel[] =
|
||||
{ BTN_TRIGGER, BTN_TOP, BTN_THUMB, BTN_TOP2, BTN_BASE,
|
||||
BTN_BASE2, BTN_BASE3, BTN_BASE4, BTN_BASE5, BTN_A, BTN_B, BTN_C, -1 };
|
||||
|
||||
static signed short btn_avb_tw[] =
|
||||
{ BTN_TRIGGER, BTN_THUMB, BTN_TOP, BTN_TOP2, BTN_BASE,
|
||||
BTN_BASE2, BTN_BASE3, BTN_BASE4, -1 };
|
||||
|
||||
static signed short btn_avb_wheel[] =
|
||||
{ BTN_GEAR_DOWN, BTN_GEAR_UP, BTN_BASE, BTN_BASE2, BTN_BASE3,
|
||||
BTN_BASE4, BTN_BASE5, BTN_BASE6, -1 };
|
||||
|
||||
@@ -73,9 +62,9 @@ static struct iforce_device iforce_device[] = {
|
||||
{ 0x044f, 0xa01c, "Thrustmaster Motor Sport GT", btn_wheel, abs_wheel, ff_iforce },
|
||||
{ 0x046d, 0xc281, "Logitech WingMan Force", btn_joystick, abs_joystick, ff_iforce },
|
||||
{ 0x046d, 0xc291, "Logitech WingMan Formula Force", btn_wheel, abs_wheel, ff_iforce },
|
||||
{ 0x05ef, 0x020a, "AVB Top Shot Pegasus", btn_avb_pegasus, abs_avb_pegasus, ff_iforce },
|
||||
{ 0x05ef, 0x8884, "AVB Mag Turbo Force", btn_avb_wheel, abs_wheel, ff_iforce },
|
||||
{ 0x05ef, 0x8888, "AVB Top Shot Force Feedback Racing Wheel", btn_avb_tw, abs_wheel, ff_iforce }, //?
|
||||
{ 0x05ef, 0x020a, "AVB Top Shot Pegasus", btn_joystick_avb, abs_avb_pegasus, ff_iforce },
|
||||
{ 0x05ef, 0x8884, "AVB Mag Turbo Force", btn_wheel, abs_wheel, ff_iforce },
|
||||
{ 0x05ef, 0x8888, "AVB Top Shot Force Feedback Racing Wheel", btn_wheel, abs_wheel, ff_iforce }, //?
|
||||
{ 0x061c, 0xc0a4, "ACT LABS Force RS", btn_wheel, abs_wheel, ff_iforce }, //?
|
||||
{ 0x061c, 0xc084, "ACT LABS Force RS", btn_wheel, abs_wheel, ff_iforce },
|
||||
{ 0x06f8, 0x0001, "Guillemot Race Leader Force Feedback", btn_wheel, abs_wheel, ff_iforce }, //?
|
||||
@@ -360,7 +349,7 @@ int iforce_init_device(struct iforce *iforce)
|
||||
|
||||
for (i = 0; c[i]; i++)
|
||||
if (!iforce_get_id_packet(iforce, c + i))
|
||||
iforce_dump_packet("info", iforce->ecmd, iforce->edata);
|
||||
iforce_dump_packet(iforce, "info", iforce->ecmd, iforce->edata);
|
||||
|
||||
/*
|
||||
* Disable spring, enable force feedback.
|
||||
@@ -388,7 +377,6 @@ int iforce_init_device(struct iforce *iforce)
|
||||
|
||||
for (i = 0; iforce->type->btn[i] >= 0; i++)
|
||||
set_bit(iforce->type->btn[i], input_dev->keybit);
|
||||
set_bit(BTN_DEAD, input_dev->keybit);
|
||||
|
||||
for (i = 0; iforce->type->abs[i] >= 0; i++) {
|
||||
|
||||
|
@@ -19,10 +19,6 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Should you need to contact me, the author, you can do so either by
|
||||
* e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
|
||||
* Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
|
||||
*/
|
||||
|
||||
#include "iforce.h"
|
||||
@@ -33,14 +29,10 @@ static struct {
|
||||
} iforce_hat_to_axis[16] = {{ 0,-1}, { 1,-1}, { 1, 0}, { 1, 1}, { 0, 1}, {-1, 1}, {-1, 0}, {-1,-1}};
|
||||
|
||||
|
||||
void iforce_dump_packet(char *msg, u16 cmd, unsigned char *data)
|
||||
void iforce_dump_packet(struct iforce *iforce, char *msg, u16 cmd, unsigned char *data)
|
||||
{
|
||||
int i;
|
||||
|
||||
printk(KERN_DEBUG __FILE__ ": %s cmd = %04x, data = ", msg, cmd);
|
||||
for (i = 0; i < LO(cmd); i++)
|
||||
printk("%02x ", data[i]);
|
||||
printk("\n");
|
||||
dev_dbg(iforce->dev->dev.parent, "%s %s cmd = %04x, data = %*ph\n",
|
||||
__func__, msg, cmd, LO(cmd), data);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -255,7 +247,7 @@ int iforce_get_id_packet(struct iforce *iforce, char *packet)
|
||||
iforce->cr.bRequest = packet[0];
|
||||
iforce->ctrl->dev = iforce->usbdev;
|
||||
|
||||
status = usb_submit_urb(iforce->ctrl, GFP_ATOMIC);
|
||||
status = usb_submit_urb(iforce->ctrl, GFP_KERNEL);
|
||||
if (status) {
|
||||
dev_err(&iforce->intf->dev,
|
||||
"usb_submit_urb failed %d\n", status);
|
||||
|
@@ -19,10 +19,6 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Should you need to contact me, the author, you can do so either by
|
||||
* e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
|
||||
* Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
|
||||
*/
|
||||
|
||||
#include "iforce.h"
|
||||
|
@@ -19,10 +19,6 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Should you need to contact me, the author, you can do so either by
|
||||
* e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
|
||||
* Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
|
||||
*/
|
||||
|
||||
#include "iforce.h"
|
||||
|
@@ -19,10 +19,6 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Should you need to contact me, the author, you can do so either by
|
||||
* e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
|
||||
* Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
@@ -158,7 +154,7 @@ int iforce_init_device(struct iforce *iforce);
|
||||
int iforce_control_playback(struct iforce*, u16 id, unsigned int);
|
||||
void iforce_process_packet(struct iforce *iforce, u16 cmd, unsigned char *data);
|
||||
int iforce_send_packet(struct iforce *iforce, u16 cmd, unsigned char* data);
|
||||
void iforce_dump_packet(char *msg, u16 cmd, unsigned char *data) ;
|
||||
void iforce_dump_packet(struct iforce *iforce, char *msg, u16 cmd, unsigned char *data);
|
||||
int iforce_get_id_packet(struct iforce *iforce, char *packet);
|
||||
|
||||
/* iforce-ff.c */
|
||||
|
@@ -23,10 +23,6 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Should you need to contact me, the author, you can do so either by
|
||||
* e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
|
||||
* Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
|
@@ -21,10 +21,6 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Should you need to contact me, the author, you can do so either by
|
||||
* e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
|
||||
* Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
|
||||
*/
|
||||
|
||||
#include <linux/module.h>
|
||||
|
@@ -20,10 +20,6 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Should you need to contact me, the author, you can do so either by
|
||||
* e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
|
||||
* Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
|
@@ -3,7 +3,6 @@
|
||||
* Driver for Phoenix RC Flight Controller Adapter
|
||||
*
|
||||
* Copyright (C) 2018 Marcus Folkesson <marcus.folkesson@gmail.com>
|
||||
*
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
@@ -16,31 +15,22 @@
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/input.h>
|
||||
|
||||
#define PXRC_VENDOR_ID (0x1781)
|
||||
#define PXRC_PRODUCT_ID (0x0898)
|
||||
|
||||
static const struct usb_device_id pxrc_table[] = {
|
||||
{ USB_DEVICE(PXRC_VENDOR_ID, PXRC_PRODUCT_ID) },
|
||||
{ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(usb, pxrc_table);
|
||||
#define PXRC_VENDOR_ID 0x1781
|
||||
#define PXRC_PRODUCT_ID 0x0898
|
||||
|
||||
struct pxrc {
|
||||
struct input_dev *input;
|
||||
struct usb_device *udev;
|
||||
struct usb_interface *intf;
|
||||
struct urb *urb;
|
||||
struct mutex pm_mutex;
|
||||
bool is_open;
|
||||
__u8 epaddr;
|
||||
char phys[64];
|
||||
unsigned char *data;
|
||||
size_t bsize;
|
||||
};
|
||||
|
||||
static void pxrc_usb_irq(struct urb *urb)
|
||||
{
|
||||
struct pxrc *pxrc = urb->context;
|
||||
u8 *data = urb->transfer_buffer;
|
||||
int error;
|
||||
|
||||
switch (urb->status) {
|
||||
@@ -68,15 +58,15 @@ static void pxrc_usb_irq(struct urb *urb)
|
||||
}
|
||||
|
||||
if (urb->actual_length == 8) {
|
||||
input_report_abs(pxrc->input, ABS_X, pxrc->data[0]);
|
||||
input_report_abs(pxrc->input, ABS_Y, pxrc->data[2]);
|
||||
input_report_abs(pxrc->input, ABS_RX, pxrc->data[3]);
|
||||
input_report_abs(pxrc->input, ABS_RY, pxrc->data[4]);
|
||||
input_report_abs(pxrc->input, ABS_RUDDER, pxrc->data[5]);
|
||||
input_report_abs(pxrc->input, ABS_THROTTLE, pxrc->data[6]);
|
||||
input_report_abs(pxrc->input, ABS_MISC, pxrc->data[7]);
|
||||
input_report_abs(pxrc->input, ABS_X, data[0]);
|
||||
input_report_abs(pxrc->input, ABS_Y, data[2]);
|
||||
input_report_abs(pxrc->input, ABS_RX, data[3]);
|
||||
input_report_abs(pxrc->input, ABS_RY, data[4]);
|
||||
input_report_abs(pxrc->input, ABS_RUDDER, data[5]);
|
||||
input_report_abs(pxrc->input, ABS_THROTTLE, data[6]);
|
||||
input_report_abs(pxrc->input, ABS_MISC, data[7]);
|
||||
|
||||
input_report_key(pxrc->input, BTN_A, pxrc->data[1]);
|
||||
input_report_key(pxrc->input, BTN_A, data[1]);
|
||||
}
|
||||
|
||||
exit:
|
||||
@@ -120,61 +110,73 @@ static void pxrc_close(struct input_dev *input)
|
||||
mutex_unlock(&pxrc->pm_mutex);
|
||||
}
|
||||
|
||||
static int pxrc_usb_init(struct pxrc *pxrc)
|
||||
static void pxrc_free_urb(void *_pxrc)
|
||||
{
|
||||
struct usb_endpoint_descriptor *epirq;
|
||||
unsigned int pipe;
|
||||
int retval;
|
||||
|
||||
/* Set up the endpoint information */
|
||||
/* This device only has an interrupt endpoint */
|
||||
retval = usb_find_common_endpoints(pxrc->intf->cur_altsetting,
|
||||
NULL, NULL, &epirq, NULL);
|
||||
if (retval) {
|
||||
dev_err(&pxrc->intf->dev,
|
||||
"Could not find endpoint\n");
|
||||
goto error;
|
||||
}
|
||||
|
||||
pxrc->bsize = usb_endpoint_maxp(epirq);
|
||||
pxrc->epaddr = epirq->bEndpointAddress;
|
||||
pxrc->data = devm_kmalloc(&pxrc->intf->dev, pxrc->bsize, GFP_KERNEL);
|
||||
if (!pxrc->data) {
|
||||
retval = -ENOMEM;
|
||||
goto error;
|
||||
}
|
||||
|
||||
usb_set_intfdata(pxrc->intf, pxrc);
|
||||
usb_make_path(pxrc->udev, pxrc->phys, sizeof(pxrc->phys));
|
||||
strlcat(pxrc->phys, "/input0", sizeof(pxrc->phys));
|
||||
|
||||
pxrc->urb = usb_alloc_urb(0, GFP_KERNEL);
|
||||
if (!pxrc->urb) {
|
||||
retval = -ENOMEM;
|
||||
goto error;
|
||||
}
|
||||
|
||||
pipe = usb_rcvintpipe(pxrc->udev, pxrc->epaddr),
|
||||
usb_fill_int_urb(pxrc->urb, pxrc->udev, pipe, pxrc->data, pxrc->bsize,
|
||||
pxrc_usb_irq, pxrc, 1);
|
||||
|
||||
error:
|
||||
return retval;
|
||||
|
||||
struct pxrc *pxrc = _pxrc;
|
||||
|
||||
usb_free_urb(pxrc->urb);
|
||||
}
|
||||
|
||||
static int pxrc_input_init(struct pxrc *pxrc)
|
||||
static int pxrc_probe(struct usb_interface *intf,
|
||||
const struct usb_device_id *id)
|
||||
{
|
||||
pxrc->input = devm_input_allocate_device(&pxrc->intf->dev);
|
||||
if (pxrc->input == NULL) {
|
||||
dev_err(&pxrc->intf->dev, "couldn't allocate input device\n");
|
||||
struct usb_device *udev = interface_to_usbdev(intf);
|
||||
struct pxrc *pxrc;
|
||||
struct usb_endpoint_descriptor *epirq;
|
||||
size_t xfer_size;
|
||||
void *xfer_buf;
|
||||
int error;
|
||||
|
||||
/*
|
||||
* Locate the endpoint information. This device only has an
|
||||
* interrupt endpoint.
|
||||
*/
|
||||
error = usb_find_common_endpoints(intf->cur_altsetting,
|
||||
NULL, NULL, &epirq, NULL);
|
||||
if (error) {
|
||||
dev_err(&intf->dev, "Could not find endpoint\n");
|
||||
return error;
|
||||
}
|
||||
|
||||
pxrc = devm_kzalloc(&intf->dev, sizeof(*pxrc), GFP_KERNEL);
|
||||
if (!pxrc)
|
||||
return -ENOMEM;
|
||||
|
||||
mutex_init(&pxrc->pm_mutex);
|
||||
pxrc->intf = intf;
|
||||
|
||||
usb_set_intfdata(pxrc->intf, pxrc);
|
||||
|
||||
xfer_size = usb_endpoint_maxp(epirq);
|
||||
xfer_buf = devm_kmalloc(&intf->dev, xfer_size, GFP_KERNEL);
|
||||
if (!xfer_buf)
|
||||
return -ENOMEM;
|
||||
|
||||
pxrc->urb = usb_alloc_urb(0, GFP_KERNEL);
|
||||
if (!pxrc->urb)
|
||||
return -ENOMEM;
|
||||
|
||||
error = devm_add_action_or_reset(&intf->dev, pxrc_free_urb, pxrc);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
usb_fill_int_urb(pxrc->urb, udev,
|
||||
usb_rcvintpipe(udev, epirq->bEndpointAddress),
|
||||
xfer_buf, xfer_size, pxrc_usb_irq, pxrc, 1);
|
||||
|
||||
pxrc->input = devm_input_allocate_device(&intf->dev);
|
||||
if (!pxrc->input) {
|
||||
dev_err(&intf->dev, "couldn't allocate input device\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
pxrc->input->name = "PXRC Flight Controller Adapter";
|
||||
|
||||
usb_make_path(udev, pxrc->phys, sizeof(pxrc->phys));
|
||||
strlcat(pxrc->phys, "/input0", sizeof(pxrc->phys));
|
||||
pxrc->input->phys = pxrc->phys;
|
||||
usb_to_input_id(pxrc->udev, &pxrc->input->id);
|
||||
|
||||
usb_to_input_id(udev, &pxrc->input->id);
|
||||
|
||||
pxrc->input->open = pxrc_open;
|
||||
pxrc->input->close = pxrc_close;
|
||||
@@ -190,46 +192,16 @@ static int pxrc_input_init(struct pxrc *pxrc)
|
||||
|
||||
input_set_drvdata(pxrc->input, pxrc);
|
||||
|
||||
return input_register_device(pxrc->input);
|
||||
}
|
||||
|
||||
static int pxrc_probe(struct usb_interface *intf,
|
||||
const struct usb_device_id *id)
|
||||
{
|
||||
struct pxrc *pxrc;
|
||||
int retval;
|
||||
|
||||
pxrc = devm_kzalloc(&intf->dev, sizeof(*pxrc), GFP_KERNEL);
|
||||
if (!pxrc)
|
||||
return -ENOMEM;
|
||||
|
||||
mutex_init(&pxrc->pm_mutex);
|
||||
pxrc->udev = usb_get_dev(interface_to_usbdev(intf));
|
||||
pxrc->intf = intf;
|
||||
|
||||
retval = pxrc_usb_init(pxrc);
|
||||
if (retval)
|
||||
goto error;
|
||||
|
||||
retval = pxrc_input_init(pxrc);
|
||||
if (retval)
|
||||
goto err_free_urb;
|
||||
error = input_register_device(pxrc->input);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
return 0;
|
||||
|
||||
err_free_urb:
|
||||
usb_free_urb(pxrc->urb);
|
||||
|
||||
error:
|
||||
return retval;
|
||||
}
|
||||
|
||||
static void pxrc_disconnect(struct usb_interface *intf)
|
||||
{
|
||||
struct pxrc *pxrc = usb_get_intfdata(intf);
|
||||
|
||||
usb_free_urb(pxrc->urb);
|
||||
usb_set_intfdata(intf, NULL);
|
||||
/* All driver resources are devm-managed. */
|
||||
}
|
||||
|
||||
static int pxrc_suspend(struct usb_interface *intf, pm_message_t message)
|
||||
@@ -284,6 +256,12 @@ static int pxrc_reset_resume(struct usb_interface *intf)
|
||||
return pxrc_resume(intf);
|
||||
}
|
||||
|
||||
static const struct usb_device_id pxrc_table[] = {
|
||||
{ USB_DEVICE(PXRC_VENDOR_ID, PXRC_PRODUCT_ID) },
|
||||
{ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(usb, pxrc_table);
|
||||
|
||||
static struct usb_driver pxrc_driver = {
|
||||
.name = "pxrc",
|
||||
.probe = pxrc_probe,
|
||||
|
@@ -20,10 +20,6 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Should you need to contact me, the author, you can do so either by
|
||||
* e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
|
||||
* Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
|
||||
*/
|
||||
|
||||
#include <linux/delay.h>
|
||||
|
@@ -24,10 +24,6 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Should you need to contact me, the author, you can do so either by
|
||||
* e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
|
||||
* Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
|
@@ -23,10 +23,6 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Should you need to contact me, the author, you can do so either by
|
||||
* e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
|
||||
* Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
|
@@ -21,10 +21,6 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Should you need to contact me, the author, you can do so either by
|
||||
* e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
|
||||
* Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
|
@@ -23,10 +23,6 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Should you need to contact me, the author, you can do so either by
|
||||
* e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
|
||||
* Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
|
||||
*/
|
||||
|
||||
#include <linux/delay.h>
|
||||
|
@@ -23,10 +23,6 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Should you need to contact me, the author, you can do so either by
|
||||
* e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
|
||||
* Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
|
@@ -20,10 +20,6 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Should you need to contact me, the author, you can do so either by
|
||||
* e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
|
||||
* Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
|
Reference in New Issue
Block a user