.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * HackRF driver |
---|
3 | 4 | * |
---|
4 | 5 | * Copyright (C) 2014 Antti Palosaari <crope@iki.fi> |
---|
5 | | - * |
---|
6 | | - * This program is free software; you can redistribute it and/or modify |
---|
7 | | - * it under the terms of the GNU General Public License as published by |
---|
8 | | - * the Free Software Foundation; either version 2 of the License, or |
---|
9 | | - * (at your option) any later version. |
---|
10 | | - * |
---|
11 | | - * This program is distributed in the hope that it will be useful, |
---|
12 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
13 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
14 | | - * GNU General Public License for more details. |
---|
15 | 6 | */ |
---|
16 | 7 | |
---|
17 | 8 | #include <linux/module.h> |
---|
.. | .. |
---|
905 | 896 | { |
---|
906 | 897 | struct hackrf_dev *dev = video_drvdata(file); |
---|
907 | 898 | struct usb_interface *intf = dev->intf; |
---|
908 | | - struct video_device *vdev = video_devdata(file); |
---|
909 | 899 | |
---|
910 | 900 | dev_dbg(&intf->dev, "\n"); |
---|
911 | 901 | |
---|
912 | | - cap->device_caps = V4L2_CAP_STREAMING | V4L2_CAP_READWRITE; |
---|
913 | | - if (vdev->vfl_dir == VFL_DIR_RX) |
---|
914 | | - cap->device_caps |= V4L2_CAP_SDR_CAPTURE | V4L2_CAP_TUNER; |
---|
915 | | - else |
---|
916 | | - cap->device_caps |= V4L2_CAP_SDR_OUTPUT | V4L2_CAP_MODULATOR; |
---|
917 | | - |
---|
918 | 902 | cap->capabilities = V4L2_CAP_SDR_CAPTURE | V4L2_CAP_TUNER | |
---|
919 | 903 | V4L2_CAP_SDR_OUTPUT | V4L2_CAP_MODULATOR | |
---|
920 | | - V4L2_CAP_DEVICE_CAPS | cap->device_caps; |
---|
921 | | - strlcpy(cap->driver, KBUILD_MODNAME, sizeof(cap->driver)); |
---|
922 | | - strlcpy(cap->card, dev->rx_vdev.name, sizeof(cap->card)); |
---|
| 904 | + V4L2_CAP_STREAMING | V4L2_CAP_READWRITE | |
---|
| 905 | + V4L2_CAP_DEVICE_CAPS; |
---|
| 906 | + strscpy(cap->driver, KBUILD_MODNAME, sizeof(cap->driver)); |
---|
| 907 | + strscpy(cap->card, dev->rx_vdev.name, sizeof(cap->card)); |
---|
923 | 908 | usb_make_path(dev->udev, cap->bus_info, sizeof(cap->bus_info)); |
---|
924 | 909 | |
---|
925 | 910 | return 0; |
---|
.. | .. |
---|
1041 | 1026 | dev_dbg(dev->dev, "index=%d\n", v->index); |
---|
1042 | 1027 | |
---|
1043 | 1028 | if (v->index == 0) { |
---|
1044 | | - strlcpy(v->name, "HackRF ADC", sizeof(v->name)); |
---|
| 1029 | + strscpy(v->name, "HackRF ADC", sizeof(v->name)); |
---|
1045 | 1030 | v->type = V4L2_TUNER_SDR; |
---|
1046 | 1031 | v->capability = V4L2_TUNER_CAP_1HZ | V4L2_TUNER_CAP_FREQ_BANDS; |
---|
1047 | 1032 | v->rangelow = bands_adc_dac[0].rangelow; |
---|
1048 | 1033 | v->rangehigh = bands_adc_dac[0].rangehigh; |
---|
1049 | 1034 | ret = 0; |
---|
1050 | 1035 | } else if (v->index == 1) { |
---|
1051 | | - strlcpy(v->name, "HackRF RF", sizeof(v->name)); |
---|
| 1036 | + strscpy(v->name, "HackRF RF", sizeof(v->name)); |
---|
1052 | 1037 | v->type = V4L2_TUNER_RF; |
---|
1053 | 1038 | v->capability = V4L2_TUNER_CAP_1HZ | V4L2_TUNER_CAP_FREQ_BANDS; |
---|
1054 | 1039 | v->rangelow = bands_rx_tx[0].rangelow; |
---|
.. | .. |
---|
1080 | 1065 | dev_dbg(dev->dev, "index=%d\n", a->index); |
---|
1081 | 1066 | |
---|
1082 | 1067 | if (a->index == 0) { |
---|
1083 | | - strlcpy(a->name, "HackRF DAC", sizeof(a->name)); |
---|
| 1068 | + strscpy(a->name, "HackRF DAC", sizeof(a->name)); |
---|
1084 | 1069 | a->type = V4L2_TUNER_SDR; |
---|
1085 | 1070 | a->capability = V4L2_TUNER_CAP_1HZ | V4L2_TUNER_CAP_FREQ_BANDS; |
---|
1086 | 1071 | a->rangelow = bands_adc_dac[0].rangelow; |
---|
1087 | 1072 | a->rangehigh = bands_adc_dac[0].rangehigh; |
---|
1088 | 1073 | ret = 0; |
---|
1089 | 1074 | } else if (a->index == 1) { |
---|
1090 | | - strlcpy(a->name, "HackRF RF", sizeof(a->name)); |
---|
| 1075 | + strscpy(a->name, "HackRF RF", sizeof(a->name)); |
---|
1091 | 1076 | a->type = V4L2_TUNER_RF; |
---|
1092 | 1077 | a->capability = V4L2_TUNER_CAP_1HZ | V4L2_TUNER_CAP_FREQ_BANDS; |
---|
1093 | 1078 | a->rangelow = bands_rx_tx[0].rangelow; |
---|
.. | .. |
---|
1496 | 1481 | dev->rx_vdev.ctrl_handler = &dev->rx_ctrl_handler; |
---|
1497 | 1482 | dev->rx_vdev.lock = &dev->v4l2_lock; |
---|
1498 | 1483 | dev->rx_vdev.vfl_dir = VFL_DIR_RX; |
---|
| 1484 | + dev->rx_vdev.device_caps = V4L2_CAP_STREAMING | V4L2_CAP_READWRITE | |
---|
| 1485 | + V4L2_CAP_SDR_CAPTURE | V4L2_CAP_TUNER; |
---|
1499 | 1486 | video_set_drvdata(&dev->rx_vdev, dev); |
---|
1500 | 1487 | ret = video_register_device(&dev->rx_vdev, VFL_TYPE_SDR, -1); |
---|
1501 | 1488 | if (ret) { |
---|
.. | .. |
---|
1514 | 1501 | dev->tx_vdev.ctrl_handler = &dev->tx_ctrl_handler; |
---|
1515 | 1502 | dev->tx_vdev.lock = &dev->v4l2_lock; |
---|
1516 | 1503 | dev->tx_vdev.vfl_dir = VFL_DIR_TX; |
---|
| 1504 | + dev->tx_vdev.device_caps = V4L2_CAP_STREAMING | V4L2_CAP_READWRITE | |
---|
| 1505 | + V4L2_CAP_SDR_OUTPUT | V4L2_CAP_MODULATOR; |
---|
1517 | 1506 | video_set_drvdata(&dev->tx_vdev, dev); |
---|
1518 | 1507 | ret = video_register_device(&dev->tx_vdev, VFL_TYPE_SDR, -1); |
---|
1519 | 1508 | if (ret) { |
---|