* How to get device supported ctrl modes from userspace
@ 2017-03-09 20:38 Lars Susaas
2017-03-09 21:52 ` Wolfgang Grandegger
0 siblings, 1 reply; 7+ messages in thread
From: Lars Susaas @ 2017-03-09 20:38 UTC (permalink / raw)
To: linux-can
Hi,
I would like find out how to get information about which control modes
the device supports from userspace.
Ctrlmode as in CAN_CTRLMODE_LISTENONLY
In the driver code is looks like it is found in
priv->can.ctrlmode_supported, but how do i get it from userspace?
I am unable to find any information about this.
Lars
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: How to get device supported ctrl modes from userspace
2017-03-09 20:38 How to get device supported ctrl modes from userspace Lars Susaas
@ 2017-03-09 21:52 ` Wolfgang Grandegger
2017-03-13 21:26 ` Lars Susaas
0 siblings, 1 reply; 7+ messages in thread
From: Wolfgang Grandegger @ 2017-03-09 21:52 UTC (permalink / raw)
To: Lars Susaas, linux-can
Hello Lars,
Am 09.03.2017 um 21:38 schrieb Lars Susaas:
> Hi,
>
> I would like find out how to get information about which control modes
> the device supports from userspace.
> Ctrlmode as in CAN_CTRLMODE_LISTENONLY
>
> In the driver code is looks like it is found in
> priv->can.ctrlmode_supported, but how do i get it from userspace?
>
> I am unable to find any information about this.
You could probe the mode. If it's not supported, EOPNOTSUP will be returned:
# ip -d -s link set can0 type can one-shot on
RTNETLINK answers: Operation not supported
Thinking about it... It would be nice to list the supported modes with:
# ip -d link show can0
Wolfgang.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: How to get device supported ctrl modes from userspace
2017-03-09 21:52 ` Wolfgang Grandegger
@ 2017-03-13 21:26 ` Lars Susaas
2017-03-14 7:27 ` Wolfgang Grandegger
0 siblings, 1 reply; 7+ messages in thread
From: Lars Susaas @ 2017-03-13 21:26 UTC (permalink / raw)
To: Wolfgang Grandegger; +Cc: linux-can
>> I would like find out how to get information about which control modes
>> the device supports from userspace.
>> Ctrlmode as in CAN_CTRLMODE_LISTENONLY
>>
>> In the driver code is looks like it is found in
>> priv->can.ctrlmode_supported, but how do i get it from userspace?
>>
>> I am unable to find any information about this.
>
> You could probe the mode. If it's not supported, EOPNOTSUP will be returned:
>
> # ip -d -s link set can0 type can one-shot on
> RTNETLINK answers: Operation not supported
Thanks for the tip, it works!
For the record, trying to turn the modes off instead of on have the
same results and work with can-fd out of the box.
> Thinking about it... It would be nice to list the supported modes with:
>
> # ip -d link show can0
Yes, that is what i was dreaming/looking for :)
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: How to get device supported ctrl modes from userspace
2017-03-13 21:26 ` Lars Susaas
@ 2017-03-14 7:27 ` Wolfgang Grandegger
2017-03-14 16:50 ` Lars Susaas
0 siblings, 1 reply; 7+ messages in thread
From: Wolfgang Grandegger @ 2017-03-14 7:27 UTC (permalink / raw)
To: Lars Susaas; +Cc: linux-can
Am 13.03.2017 um 22:26 schrieb Lars Susaas:
>>> I would like find out how to get information about which control modes
>>> the device supports from userspace.
>>> Ctrlmode as in CAN_CTRLMODE_LISTENONLY
>>>
>>> In the driver code is looks like it is found in
>>> priv->can.ctrlmode_supported, but how do i get it from userspace?
>>>
>>> I am unable to find any information about this.
>>
>> You could probe the mode. If it's not supported, EOPNOTSUP will be returned:
>>
>> # ip -d -s link set can0 type can one-shot on
>> RTNETLINK answers: Operation not supported
>
> Thanks for the tip, it works!
> For the record, trying to turn the modes off instead of on have the
> same results and work with can-fd out of the box.
Sounds like a bug. Could be a bit more verbose? What does not work?
>
>> Thinking about it... It would be nice to list the supported modes with:
>>
>> # ip -d link show can0
>
> Yes, that is what i was dreaming/looking for :)
The supported feature flag is not yet available trough via netlink
interface.
Wolfgang.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: How to get device supported ctrl modes from userspace
2017-03-14 7:27 ` Wolfgang Grandegger
@ 2017-03-14 16:50 ` Lars Susaas
2017-03-14 19:12 ` Wolfgang Grandegger
0 siblings, 1 reply; 7+ messages in thread
From: Lars Susaas @ 2017-03-14 16:50 UTC (permalink / raw)
To: Wolfgang Grandegger; +Cc: linux-can
On Tue, Mar 14, 2017 at 8:27 AM, Wolfgang Grandegger <wg@grandegger.com> wrote:
> Am 13.03.2017 um 22:26 schrieb Lars Susaas:
>>>>
>>>> I would like find out how to get information about which control modes
>>>> the device supports from userspace.
>>>> Ctrlmode as in CAN_CTRLMODE_LISTENONLY
>>>>
>>>> In the driver code is looks like it is found in
>>>> priv->can.ctrlmode_supported, but how do i get it from userspace?
>>>>
>>>> I am unable to find any information about this.
>>>
>>>
>>> You could probe the mode. If it's not supported, EOPNOTSUP will be
>>> returned:
>>>
>>> # ip -d -s link set can0 type can one-shot on
>>> RTNETLINK answers: Operation not supported
>>
>>
>> Thanks for the tip, it works!
>> For the record, trying to turn the modes off instead of on have the
>> same results and work with can-fd out of the box.
>
>
> Sounds like a bug. Could be a bit more verbose? What does not work?
Using ubuntu 16.10 (Linux 4.8.0-41-generic) and testing with a
'pcan-usb pro fd'
As far as i can see in the sourcecode it supports triple-sampling,
listen-only and fd
Just startet the computer and connected the can device
#ip -d -s link set can0 type can fd on
RTNETLINK answers: Operation not supported
#ip -d -s link set can0 type can fd off
(no error)
If I try to turn modes on to test support for fd support i would fail.
But it looks like i can detect support for fd by trying to turn it off.
I would need the change mtu to be able to turn on fd.
As i just want to find out if a feature is supported, trying to turn
it off looks like more universal way of testing
Testing some more to check that it works on other modes to.
#ip -d -s link set can0 type can loopback on
RTNETLINK answers: Operation not supported
#ip -d -s link set can0 type can loopback off
RTNETLINK answers: Operation not supported
#ip -d -s link set can0 type can listen-only on
#ip -d -s link set can0 type can listen-only off
(no error)
Testing the rest of the modes gives the same result when i try to turn
it on and off, but fd mode differs.
>>> Thinking about it... It would be nice to list the supported modes with:
>>>
>>> # ip -d link show can0
>>
>>
>> Yes, that is what i was dreaming/looking for :)
>
>
> The supported feature flag is not yet available trough via netlink
> interface.
I understand and thanks for taking the time to help me out
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: How to get device supported ctrl modes from userspace
2017-03-14 16:50 ` Lars Susaas
@ 2017-03-14 19:12 ` Wolfgang Grandegger
2017-03-14 20:20 ` Lars Susaas
0 siblings, 1 reply; 7+ messages in thread
From: Wolfgang Grandegger @ 2017-03-14 19:12 UTC (permalink / raw)
To: Lars Susaas; +Cc: linux-can
Am 14.03.2017 um 17:50 schrieb Lars Susaas:
> On Tue, Mar 14, 2017 at 8:27 AM, Wolfgang Grandegger <wg@grandegger.com> wrote:
>> Am 13.03.2017 um 22:26 schrieb Lars Susaas:
>>>>>
>>>>> I would like find out how to get information about which control modes
>>>>> the device supports from userspace.
>>>>> Ctrlmode as in CAN_CTRLMODE_LISTENONLY
>>>>>
>>>>> In the driver code is looks like it is found in
>>>>> priv->can.ctrlmode_supported, but how do i get it from userspace?
>>>>>
>>>>> I am unable to find any information about this.
>>>>
>>>>
>>>> You could probe the mode. If it's not supported, EOPNOTSUP will be
>>>> returned:
>>>>
>>>> # ip -d -s link set can0 type can one-shot on
>>>> RTNETLINK answers: Operation not supported
>>>
>>>
>>> Thanks for the tip, it works!
>>> For the record, trying to turn the modes off instead of on have the
>>> same results and work with can-fd out of the box.
>>
>>
>> Sounds like a bug. Could be a bit more verbose? What does not work?
>
> Using ubuntu 16.10 (Linux 4.8.0-41-generic) and testing with a
> 'pcan-usb pro fd'
> As far as i can see in the sourcecode it supports triple-sampling,
> listen-only and fd
>
> Just startet the computer and connected the can device
>
> #ip -d -s link set can0 type can fd on
> RTNETLINK answers: Operation not supported
> #ip -d -s link set can0 type can fd off
> (no error)
>
> If I try to turn modes on to test support for fd support i would fail.
> But it looks like i can detect support for fd by trying to turn it off.
>
> I would need the change mtu to be able to turn on fd.
> As i just want to find out if a feature is supported, trying to turn
> it off looks like more universal way of testing
>
> Testing some more to check that it works on other modes to.
> #ip -d -s link set can0 type can loopback on
> RTNETLINK answers: Operation not supported
> #ip -d -s link set can0 type can loopback off
> RTNETLINK answers: Operation not supported
> #ip -d -s link set can0 type can listen-only on
> #ip -d -s link set can0 type can listen-only off
> (no error)
>
> Testing the rest of the modes gives the same result when i try to turn
> it on and off, but fd mode differs.
See:
http://lxr.free-electrons.com/source/drivers/net/can/dev.c#L847
You need to provide proper bittiming parameters as well. Turning the
ctrlmode off does nothing if it's not already on.
Wolfgang.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: How to get device supported ctrl modes from userspace
2017-03-14 19:12 ` Wolfgang Grandegger
@ 2017-03-14 20:20 ` Lars Susaas
0 siblings, 0 replies; 7+ messages in thread
From: Lars Susaas @ 2017-03-14 20:20 UTC (permalink / raw)
To: Wolfgang Grandegger; +Cc: linux-can
On Tue, Mar 14, 2017 at 8:12 PM, Wolfgang Grandegger <wg@grandegger.com> wrote:
> Am 14.03.2017 um 17:50 schrieb Lars Susaas:
>>
>> On Tue, Mar 14, 2017 at 8:27 AM, Wolfgang Grandegger <wg@grandegger.com>
>> wrote:
>>>
>>> Am 13.03.2017 um 22:26 schrieb Lars Susaas:
>>>>>>
>>>>>>
>>>>>> I would like find out how to get information about which control modes
>>>>>> the device supports from userspace.
>>>>>> Ctrlmode as in CAN_CTRLMODE_LISTENONLY
>>>>>>
>>>>>> In the driver code is looks like it is found in
>>>>>> priv->can.ctrlmode_supported, but how do i get it from userspace?
>>>>>>
>>>>>> I am unable to find any information about this.
>>>>>
>>>>>
>>>>>
>>>>> You could probe the mode. If it's not supported, EOPNOTSUP will be
>>>>> returned:
>>>>>
>>>>> # ip -d -s link set can0 type can one-shot on
>>>>> RTNETLINK answers: Operation not supported
>>>>
>>>>
>>>>
>>>> Thanks for the tip, it works!
>>>> For the record, trying to turn the modes off instead of on have the
>>>> same results and work with can-fd out of the box.
>>>
>>>
>>>
>>> Sounds like a bug. Could be a bit more verbose? What does not work?
>>
>>
>> Using ubuntu 16.10 (Linux 4.8.0-41-generic) and testing with a
>> 'pcan-usb pro fd'
>> As far as i can see in the sourcecode it supports triple-sampling,
>> listen-only and fd
>>
>> Just startet the computer and connected the can device
>>
>> #ip -d -s link set can0 type can fd on
>> RTNETLINK answers: Operation not supported
>> #ip -d -s link set can0 type can fd off
>> (no error)
>>
>> If I try to turn modes on to test support for fd support i would fail.
>> But it looks like i can detect support for fd by trying to turn it off.
>>
>> I would need the change mtu to be able to turn on fd.
>> As i just want to find out if a feature is supported, trying to turn
>> it off looks like more universal way of testing
>>
>> Testing some more to check that it works on other modes to.
>> #ip -d -s link set can0 type can loopback on
>> RTNETLINK answers: Operation not supported
>> #ip -d -s link set can0 type can loopback off
>> RTNETLINK answers: Operation not supported
>> #ip -d -s link set can0 type can listen-only on
>> #ip -d -s link set can0 type can listen-only off
>> (no error)
>>
>> Testing the rest of the modes gives the same result when i try to turn
>> it on and off, but fd mode differs.
>
>
> See:
>
> http://lxr.free-electrons.com/source/drivers/net/can/dev.c#L847
>
> You need to provide proper bittiming parameters as well. Turning the
> ctrlmode off does nothing if it's not already on.
>
Oh, I see.
Will check by turning feature on then, and make sure bittiming is set
before testing for fd
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2017-03-14 20:20 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-09 20:38 How to get device supported ctrl modes from userspace Lars Susaas
2017-03-09 21:52 ` Wolfgang Grandegger
2017-03-13 21:26 ` Lars Susaas
2017-03-14 7:27 ` Wolfgang Grandegger
2017-03-14 16:50 ` Lars Susaas
2017-03-14 19:12 ` Wolfgang Grandegger
2017-03-14 20:20 ` Lars Susaas
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.