| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * AirSpy SDR 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> |
|---|
| .. | .. |
|---|
| 80 | 71 | |
|---|
| 81 | 72 | /* stream formats */ |
|---|
| 82 | 73 | struct airspy_format { |
|---|
| 83 | | - char *name; |
|---|
| 84 | 74 | u32 pixelformat; |
|---|
| 85 | 75 | u32 buffersize; |
|---|
| 86 | 76 | }; |
|---|
| .. | .. |
|---|
| 88 | 78 | /* format descriptions for capture and preview */ |
|---|
| 89 | 79 | static struct airspy_format formats[] = { |
|---|
| 90 | 80 | { |
|---|
| 91 | | - .name = "Real U12LE", |
|---|
| 92 | 81 | .pixelformat = V4L2_SDR_FMT_RU12LE, |
|---|
| 93 | 82 | .buffersize = BULK_BUFFER_SIZE, |
|---|
| 94 | 83 | }, |
|---|
| .. | .. |
|---|
| 619 | 608 | { |
|---|
| 620 | 609 | struct airspy *s = video_drvdata(file); |
|---|
| 621 | 610 | |
|---|
| 622 | | - strlcpy(cap->driver, KBUILD_MODNAME, sizeof(cap->driver)); |
|---|
| 623 | | - strlcpy(cap->card, s->vdev.name, sizeof(cap->card)); |
|---|
| 611 | + strscpy(cap->driver, KBUILD_MODNAME, sizeof(cap->driver)); |
|---|
| 612 | + strscpy(cap->card, s->vdev.name, sizeof(cap->card)); |
|---|
| 624 | 613 | usb_make_path(s->udev, cap->bus_info, sizeof(cap->bus_info)); |
|---|
| 625 | | - cap->device_caps = V4L2_CAP_SDR_CAPTURE | V4L2_CAP_STREAMING | |
|---|
| 626 | | - V4L2_CAP_READWRITE | V4L2_CAP_TUNER; |
|---|
| 627 | | - cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS; |
|---|
| 628 | | - |
|---|
| 629 | 614 | return 0; |
|---|
| 630 | 615 | } |
|---|
| 631 | 616 | |
|---|
| .. | .. |
|---|
| 635 | 620 | if (f->index >= NUM_FORMATS) |
|---|
| 636 | 621 | return -EINVAL; |
|---|
| 637 | 622 | |
|---|
| 638 | | - strlcpy(f->description, formats[f->index].name, sizeof(f->description)); |
|---|
| 639 | 623 | f->pixelformat = formats[f->index].pixelformat; |
|---|
| 640 | 624 | |
|---|
| 641 | 625 | return 0; |
|---|
| .. | .. |
|---|
| 720 | 704 | int ret; |
|---|
| 721 | 705 | |
|---|
| 722 | 706 | if (v->index == 0) { |
|---|
| 723 | | - strlcpy(v->name, "AirSpy ADC", sizeof(v->name)); |
|---|
| 707 | + strscpy(v->name, "AirSpy ADC", sizeof(v->name)); |
|---|
| 724 | 708 | v->type = V4L2_TUNER_ADC; |
|---|
| 725 | 709 | v->capability = V4L2_TUNER_CAP_1HZ | V4L2_TUNER_CAP_FREQ_BANDS; |
|---|
| 726 | 710 | v->rangelow = bands[0].rangelow; |
|---|
| 727 | 711 | v->rangehigh = bands[0].rangehigh; |
|---|
| 728 | 712 | ret = 0; |
|---|
| 729 | 713 | } else if (v->index == 1) { |
|---|
| 730 | | - strlcpy(v->name, "AirSpy RF", sizeof(v->name)); |
|---|
| 714 | + strscpy(v->name, "AirSpy RF", sizeof(v->name)); |
|---|
| 731 | 715 | v->type = V4L2_TUNER_RF; |
|---|
| 732 | 716 | v->capability = V4L2_TUNER_CAP_1HZ | V4L2_TUNER_CAP_FREQ_BANDS; |
|---|
| 733 | 717 | v->rangelow = bands_rf[0].rangelow; |
|---|
| .. | .. |
|---|
| 1066 | 1050 | s->v4l2_dev.ctrl_handler = &s->hdl; |
|---|
| 1067 | 1051 | s->vdev.v4l2_dev = &s->v4l2_dev; |
|---|
| 1068 | 1052 | s->vdev.lock = &s->v4l2_lock; |
|---|
| 1053 | + s->vdev.device_caps = V4L2_CAP_SDR_CAPTURE | V4L2_CAP_STREAMING | |
|---|
| 1054 | + V4L2_CAP_READWRITE | V4L2_CAP_TUNER; |
|---|
| 1069 | 1055 | |
|---|
| 1070 | 1056 | ret = video_register_device(&s->vdev, VFL_TYPE_SDR, -1); |
|---|
| 1071 | 1057 | if (ret) { |
|---|