.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* DVB USB compliant linux driver for Nebula Electronics uDigiTV DVB-T USB2.0 |
---|
2 | 3 | * receiver |
---|
3 | 4 | * |
---|
.. | .. |
---|
5 | 6 | * |
---|
6 | 7 | * partly based on the SDK published by Nebula Electronics |
---|
7 | 8 | * |
---|
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 |
---|
13 | 10 | */ |
---|
14 | 11 | #include "digitv.h" |
---|
15 | 12 | |
---|
.. | .. |
---|
66 | 63 | warn("more than 2 i2c messages at a time is not handled yet. TODO."); |
---|
67 | 64 | |
---|
68 | 65 | for (i = 0; i < num; i++) { |
---|
| 66 | + if (msg[i].len < 1) { |
---|
| 67 | + i = -EOPNOTSUPP; |
---|
| 68 | + break; |
---|
| 69 | + } |
---|
69 | 70 | /* write/read request */ |
---|
70 | 71 | if (i+1 < num && (msg[i+1].flags & I2C_M_RD)) { |
---|
71 | 72 | if (digitv_ctrl_msg(d, USB_READ_COFDM, msg[i].buf[0], NULL, 0, |
---|
.. | .. |
---|
93 | 94 | }; |
---|
94 | 95 | |
---|
95 | 96 | /* 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) |
---|
| 97 | +static int digitv_identify_state(struct usb_device *udev, |
---|
| 98 | + const struct dvb_usb_device_properties *props, |
---|
| 99 | + const struct dvb_usb_device_description **desc, |
---|
| 100 | + int *cold) |
---|
99 | 101 | { |
---|
100 | 102 | *cold = udev->descriptor.iManufacturer == 0 && udev->descriptor.iProduct == 0; |
---|
101 | 103 | return 0; |
---|
.. | .. |
---|
233 | 235 | |
---|
234 | 236 | static int digitv_rc_query(struct dvb_usb_device *d, u32 *event, int *state) |
---|
235 | 237 | { |
---|
| 238 | + struct rc_map_table *entry; |
---|
236 | 239 | int ret, i; |
---|
237 | | - u8 key[5]; |
---|
| 240 | + u8 key[4]; |
---|
238 | 241 | u8 b[4] = { 0 }; |
---|
239 | 242 | |
---|
240 | 243 | *event = 0; |
---|
241 | 244 | *state = REMOTE_NO_KEY_PRESSED; |
---|
242 | 245 | |
---|
243 | | - ret = digitv_ctrl_msg(d, USB_READ_REMOTE, 0, NULL, 0, &key[1], 4); |
---|
| 246 | + ret = digitv_ctrl_msg(d, USB_READ_REMOTE, 0, NULL, 0, key, 4); |
---|
244 | 247 | if (ret) |
---|
245 | 248 | return ret; |
---|
246 | 249 | |
---|
.. | .. |
---|
251 | 254 | return ret; |
---|
252 | 255 | |
---|
253 | 256 | /* 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; |
---|
| 257 | + if (key[0] != 0) { |
---|
| 258 | + for (i = 0; i < d->props.rc.legacy.rc_map_size; i++) { |
---|
| 259 | + entry = &d->props.rc.legacy.rc_map_table[i]; |
---|
| 260 | + |
---|
| 261 | + if (rc5_custom(entry) == key[0] && |
---|
| 262 | + rc5_data(entry) == key[1]) { |
---|
| 263 | + *event = entry->keycode; |
---|
260 | 264 | *state = REMOTE_KEY_PRESSED; |
---|
261 | 265 | return 0; |
---|
262 | 266 | } |
---|
263 | 267 | } |
---|
| 268 | + |
---|
| 269 | + deb_rc("key: %*ph\n", 4, key); |
---|
264 | 270 | } |
---|
265 | 271 | |
---|
266 | | - if (key[0] != 0) |
---|
267 | | - deb_rc("key: %*ph\n", 5, key); |
---|
268 | 272 | return 0; |
---|
269 | 273 | } |
---|
270 | 274 | |
---|