| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Force feedback support for Logitech Gaming Wheels |
|---|
| 3 | 4 | * |
|---|
| .. | .. |
|---|
| 8 | 9 | */ |
|---|
| 9 | 10 | |
|---|
| 10 | 11 | /* |
|---|
| 11 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 12 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 13 | | - * the Free Software Foundation; either version 2 of the License, or |
|---|
| 14 | | - * (at your option) any later version. |
|---|
| 15 | | - * |
|---|
| 16 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 17 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 18 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 19 | | - * GNU General Public License for more details. |
|---|
| 20 | | - * |
|---|
| 21 | | - * You should have received a copy of the GNU General Public License |
|---|
| 22 | | - * along with this program; if not, write to the Free Software |
|---|
| 23 | | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|---|
| 24 | 12 | */ |
|---|
| 25 | 13 | |
|---|
| 26 | 14 | |
|---|
| .. | .. |
|---|
| 103 | 91 | -1 |
|---|
| 104 | 92 | }; |
|---|
| 105 | 93 | |
|---|
| 94 | +static const signed short no_wheel_effects[] = { |
|---|
| 95 | + -1 |
|---|
| 96 | +}; |
|---|
| 97 | + |
|---|
| 106 | 98 | struct lg4ff_wheel { |
|---|
| 107 | 99 | const u32 product_id; |
|---|
| 108 | 100 | const signed short *ff_effects; |
|---|
| .. | .. |
|---|
| 137 | 129 | }; |
|---|
| 138 | 130 | |
|---|
| 139 | 131 | static const struct lg4ff_wheel lg4ff_devices[] = { |
|---|
| 132 | + {USB_DEVICE_ID_LOGITECH_WINGMAN_FG, no_wheel_effects, 40, 180, NULL}, |
|---|
| 140 | 133 | {USB_DEVICE_ID_LOGITECH_WINGMAN_FFG, lg4ff_wheel_effects, 40, 180, NULL}, |
|---|
| 141 | 134 | {USB_DEVICE_ID_LOGITECH_WHEEL, lg4ff_wheel_effects, 40, 270, NULL}, |
|---|
| 142 | 135 | {USB_DEVICE_ID_LOGITECH_MOMO_WHEEL, lg4ff_wheel_effects, 40, 270, NULL}, |
|---|
| .. | .. |
|---|
| 346 | 339 | rd[5] = rd[3]; |
|---|
| 347 | 340 | rd[6] = 0x7F; |
|---|
| 348 | 341 | return 1; |
|---|
| 342 | + case USB_DEVICE_ID_LOGITECH_WINGMAN_FG: |
|---|
| 349 | 343 | case USB_DEVICE_ID_LOGITECH_WINGMAN_FFG: |
|---|
| 350 | 344 | case USB_DEVICE_ID_LOGITECH_MOMO_WHEEL: |
|---|
| 351 | 345 | case USB_DEVICE_ID_LOGITECH_MOMO_WHEEL2: |
|---|
| .. | .. |
|---|
| 878 | 872 | return -ENOMEM; |
|---|
| 879 | 873 | |
|---|
| 880 | 874 | i = strlen(lbuf); |
|---|
| 875 | + |
|---|
| 876 | + if (i == 0) { |
|---|
| 877 | + kfree(lbuf); |
|---|
| 878 | + return -EINVAL; |
|---|
| 879 | + } |
|---|
| 880 | + |
|---|
| 881 | 881 | if (lbuf[i-1] == '\n') { |
|---|
| 882 | 882 | if (i == 1) { |
|---|
| 883 | 883 | kfree(lbuf); |
|---|