All of lore.kernel.org
 help / color / mirror / Atom feed
From: Antti Palosaari <crope@iki.fi>
To: Hans Verkuil <hverkuil@xs4all.nl>, linux-media@vger.kernel.org
Subject: Re: [PATCHv2 8/9] hackrf: add support for transmitter
Date: Mon, 27 Jul 2015 19:19:58 +0300	[thread overview]
Message-ID: <55B65A2E.8020104@iki.fi> (raw)
In-Reply-To: <55A90E16.5040104@xs4all.nl>

On 07/17/2015 05:15 PM, Hans Verkuil wrote:
> On 07/16/2015 09:04 AM, Antti Palosaari wrote:
>> HackRF SDR device has both receiver and transmitter. There is limitation
>> that receiver and transmitter cannot be used at the same time
>> (half-duplex operation). That patch implements transmitter support to
>> existing receiver only driver.
>>
>> Cc: Hans Verkuil <hverkuil@xs4all.nl>
>> Signed-off-by: Antti Palosaari <crope@iki.fi>
>> ---
>>   drivers/media/usb/hackrf/hackrf.c | 787 +++++++++++++++++++++++++++-----------
>>   1 file changed, 572 insertions(+), 215 deletions(-)
>>
>> diff --git a/drivers/media/usb/hackrf/hackrf.c b/drivers/media/usb/hackrf/hackrf.c
>> index 5bd291b..97de9cb6 100644
>> --- a/drivers/media/usb/hackrf/hackrf.c
>> +++ b/drivers/media/usb/hackrf/hackrf.c
>> @@ -731,15 +889,19 @@ static int hackrf_querycap(struct file *file, void *fh,
>>   		struct v4l2_capability *cap)
>>   {
>>   	struct hackrf_dev *dev = video_drvdata(file);
>> +	struct video_device *vdev = video_devdata(file);
>>
>>   	dev_dbg(dev->dev, "\n");
>>
>> +	if (vdev->vfl_dir == VFL_DIR_RX)
>> +		cap->device_caps = V4L2_CAP_SDR_CAPTURE | V4L2_CAP_TUNER;
>> +	else
>> +		cap->device_caps = V4L2_CAP_SDR_OUTPUT | V4L2_CAP_MODULATOR;
>> +	cap->device_caps |= V4L2_CAP_STREAMING | V4L2_CAP_READWRITE;
>> +	cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS;
>
> The capabilities are those of the whole device, so you should OR this with
> V4L2_CAP_SDR_CAPTURE | V4L2_CAP_SDR_OUTPUT |
> V4L2_CAP_TUNER | V4L2_CAP_MODULATOR
>
>>   	strlcpy(cap->driver, KBUILD_MODNAME, sizeof(cap->driver));
>> -	strlcpy(cap->card, dev->vdev.name, sizeof(cap->card));
>> +	strlcpy(cap->card, dev->rx_vdev.name, sizeof(cap->card));
>>   	usb_make_path(dev->udev, cap->bus_info, sizeof(cap->bus_info));
>> -	cap->device_caps = V4L2_CAP_SDR_CAPTURE | V4L2_CAP_STREAMING |
>> -			V4L2_CAP_READWRITE | V4L2_CAP_TUNER;
>> -	cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS;
>>
>>   	return 0;
>>   }

Just to be sure, is it correct that:
**) cap->device_caps == capabilities of whole device, including all the 
character nodes

**) cap->capabilities == capabilities of single character node


Here is how v4l2-ctl now reports:

[crope@localhost v4l2-ctl]$ ./v4l2-ctl -d /dev/swradio0 --info
Driver Info (not using libv4l2):
	Driver name   : hackrf
	Card type     : HackRF One
	Bus info      : usb-0000:00:13.2-2
	Driver version: 4.2.0
	Capabilities  : 0x85310000
		SDR Capture
		Tuner
		Read/Write
		Streaming
		Extended Pix Format
		Device Capabilities
	Device Caps   : 0x05790000
		SDR Capture
		SDR Output
		Tuner
		Modulator
		Read/Write
		Streaming
		Extended Pix Format
[crope@localhost v4l2-ctl]$ ./v4l2-ctl -d /dev/swradio1 --info
Driver Info (not using libv4l2):
	Driver name   : hackrf
	Card type     : HackRF One
	Bus info      : usb-0000:00:13.2-2
	Driver version: 4.2.0
	Capabilities  : 0x85680000
		SDR Output
		Modulator
		Read/Write
		Streaming
		Extended Pix Format
		Device Capabilities
	Device Caps   : 0x05790000
		SDR Capture
		SDR Output
		Tuner
		Modulator
		Read/Write
		Streaming
		Extended Pix Format
[crope@localhost v4l2-ctl]$


regards
Antti


-- 
http://palosaari.fi/

  reply	other threads:[~2015-07-27 16:20 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-16  7:04 [PATCHv2 0/9] SDR transmitter API Antti Palosaari
2015-07-16  7:04 ` [PATCHv2 1/9] v4l2: rename V4L2_TUNER_ADC to V4L2_TUNER_SDR Antti Palosaari
2015-07-17 14:32   ` Hans Verkuil
2015-07-16  7:04 ` [PATCHv2 2/9] v4l2: add RF gain control Antti Palosaari
2015-07-16  7:04 ` [PATCHv2 3/9] DocBook: document tuner " Antti Palosaari
2015-07-16  7:04 ` [PATCHv2 4/9] v4l2: add support for SDR transmitter Antti Palosaari
2015-07-16  7:04 ` [PATCHv2 5/9] DocBook: document " Antti Palosaari
2015-07-16  7:04 ` [PATCHv2 6/9] hackrf: add control for RF amplifier Antti Palosaari
2015-07-16  7:04 ` [PATCHv2 7/9] hackrf: switch to single function which configures everything Antti Palosaari
2015-07-16  7:04 ` [PATCHv2 8/9] hackrf: add support for transmitter Antti Palosaari
2015-07-17 13:04   ` Hans Verkuil
2015-07-17 14:15   ` Hans Verkuil
2015-07-27 16:19     ` Antti Palosaari [this message]
2015-07-27 17:19       ` Hans Verkuil
2015-07-17 14:43   ` Hans Verkuil
2015-07-27 20:21     ` Antti Palosaari
2015-07-27 20:38       ` Hans Verkuil
2015-07-28  0:50         ` Antti Palosaari
2015-07-28  7:06           ` Hans Verkuil
2015-07-28 23:04             ` Antti Palosaari
2015-07-16  7:04 ` [PATCHv2 9/9] hackrf: do not set human readable name for formats Antti Palosaari
2015-07-17 14:46 ` [PATCHv2 0/9] SDR transmitter API Hans Verkuil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55B65A2E.8020104@iki.fi \
    --to=crope@iki.fi \
    --cc=hverkuil@xs4all.nl \
    --cc=linux-media@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.