forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-09 b22da3d8526a935aa31e086e63f60ff3246cb61c
kernel/drivers/media/usb/dvb-usb/digitv.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /* DVB USB compliant linux driver for Nebula Electronics uDigiTV DVB-T USB2.0
23 * receiver
34 *
....@@ -5,11 +6,7 @@
56 *
67 * partly based on the SDK published by Nebula Electronics
78 *
8
- * This program is free software; you can redistribute it and/or modify it
9
- * under the terms of the GNU General Public License as published by the Free
10
- * Software Foundation, version 2.
11
- *
12
- * see Documentation/media/dvb-drivers/dvb-usb.rst for more information
9
+ * see Documentation/driver-api/media/drivers/dvb-usb.rst for more information
1310 */
1411 #include "digitv.h"
1512
....@@ -93,9 +90,10 @@
9390 };
9491
9592 /* Callbacks for DVB USB */
96
-static int digitv_identify_state (struct usb_device *udev, struct
97
- dvb_usb_device_properties *props, struct dvb_usb_device_description **desc,
98
- int *cold)
93
+static int digitv_identify_state(struct usb_device *udev,
94
+ const struct dvb_usb_device_properties *props,
95
+ const struct dvb_usb_device_description **desc,
96
+ int *cold)
9997 {
10098 *cold = udev->descriptor.iManufacturer == 0 && udev->descriptor.iProduct == 0;
10199 return 0;
....@@ -233,14 +231,15 @@
233231
234232 static int digitv_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
235233 {
234
+ struct rc_map_table *entry;
236235 int ret, i;
237
- u8 key[5];
236
+ u8 key[4];
238237 u8 b[4] = { 0 };
239238
240239 *event = 0;
241240 *state = REMOTE_NO_KEY_PRESSED;
242241
243
- ret = digitv_ctrl_msg(d, USB_READ_REMOTE, 0, NULL, 0, &key[1], 4);
242
+ ret = digitv_ctrl_msg(d, USB_READ_REMOTE, 0, NULL, 0, key, 4);
244243 if (ret)
245244 return ret;
246245
....@@ -251,20 +250,21 @@
251250 return ret;
252251
253252 /* if something is inside the buffer, simulate key press */
254
- if (key[1] != 0)
255
- {
256
- for (i = 0; i < d->props.rc.legacy.rc_map_size; i++) {
257
- if (rc5_custom(&d->props.rc.legacy.rc_map_table[i]) == key[1] &&
258
- rc5_data(&d->props.rc.legacy.rc_map_table[i]) == key[2]) {
259
- *event = d->props.rc.legacy.rc_map_table[i].keycode;
253
+ if (key[0] != 0) {
254
+ for (i = 0; i < d->props.rc.legacy.rc_map_size; i++) {
255
+ entry = &d->props.rc.legacy.rc_map_table[i];
256
+
257
+ if (rc5_custom(entry) == key[0] &&
258
+ rc5_data(entry) == key[1]) {
259
+ *event = entry->keycode;
260260 *state = REMOTE_KEY_PRESSED;
261261 return 0;
262262 }
263263 }
264
+
265
+ deb_rc("key: %*ph\n", 4, key);
264266 }
265267
266
- if (key[0] != 0)
267
- deb_rc("key: %*ph\n", 5, key);
268268 return 0;
269269 }
270270