Page 1 of 2

Linux : Operation not permitted

Posted: Thu 21. Apr 2016, 09:31
by Heiko_H
Good morning,
I'm using the PEAK Usb adapter which works well.

Code: Select all

*------------- PEAK-System CAN interfaces (www.peak-system.com) -------------
*------------- Release_20150729_n (7.15.2) Nov  2 2015 15:32:59 --------------
*---------- [mod] [isa] [pci] [pec] [dng] [par] [usb] [pcc] [net] -----------
*--------------------- 1 interfaces @ major 249 found -----------------------
*n -type- -ndev- --base-- irq --btr- --read-- --write- --irqs-- -errors- status
32    usb   can0 ffffffff 000 0x001c 0000433c 00005285 0001bcf9 00002b33 0x0000

Code: Select all

ls -l /dev/pcan*
lrw-rw-rw- 1 root root       8 Apr 20 09:20 /dev/pcan32 -> pcanusb0
crw-rw-rw- 1 root root 180, 32 Apr 20 09:20 /dev/pcanusb0

/dev/pcanusb:
total 0
lrw-rw-rw-1 root root 11 Apr 20 09:20 devid=0 -> ../pcanusb0
when I run my application with sudo everything runs great. But now I wanted to run the application without root. Then i get ofcourse this errors :

RTNETLINK answers: Operation not permitted
RTNETLINK answers: Operation not permitted
RTNETLINK answers: Operation not permitted

My Question is what i have to set on Linux that I'm allow to run the application without sudo ?

Re: Linux : Operation not permitted

Posted: Thu 21. Apr 2016, 13:45
by M.Maidhof
Hi,

what do you do in your application? Do you have the same problem when using the socketCAN tools?

regards

Michael

Re: Linux : Operation not permitted

Posted: Fri 22. Apr 2016, 11:46
by Heiko_H
Hi,

I got the problem

The lib I have used try to set the bitrate and start/stop the socket witch is not supported for peak with socketcan or?

regards Heiko

Re: Linux : Operation not permitted

Posted: Fri 22. Apr 2016, 14:03
by M.Maidhof
Hi,

yes, this ip link set feature is only available in the newer 8.x driver version

best regards

Michael

BTW: when you use socketCAN, and a kernel >3.4, there is no need to install our peak-linuxdriver. The kernel already includes the Netdev driver for our hardware.

Re: Linux : Operation not permitted

Posted: Wed 11. Apr 2018, 14:32
by icarreno
Hi,

Sorry to hijack this thread.

I used mPCIe Peak Card on my system running with Ubuntu 16 and then installed version 8.x driver. I was able to received CAN messages using candump userspace application.

Now, I tried my application using socketcan and the way it works similar to Heiko's application (start/stop the socket), but for some reason I also encountered similar issue.

There is no respond the last thread if that answer solves the issue.

Best Regards,
Ian

Re: Linux : Operation not permitted

Posted: Wed 11. Apr 2018, 14:39
by M.Maidhof
Hi,

do you use the kernel drivers for SocketCAN or did you install the peak-linux-driver? Please send us the output of cat /proc/pcan if the peak-linux-driver is used.

regards

Michael

Re: Linux : Operation not permitted

Posted: Thu 12. Apr 2018, 09:56
by icarreno
Hi Michael,

I installed libsocketcan (apt install libsocketcan-dev) before issuing modprobe pcan. Here is the output of cat /proc/pcan

Code: Select all

*------------- PEAK-System CAN interfaces (http://www.peak-system.com) -------------
*------------- Release_20171027_n (8.5.1) Apr 11 2018 14:53:01 --------------
*---------- [mod] [isa] [pci] [pec] [dng] [par] [usb] [pcc] [net] -----------
*--------------------- 2 interfaces @ major 242 found -----------------------
*n -type- -ndev- --base-- irq --btr- --read-- --write- --irqs-- -errors- status
 0    pci   can0 90700000 016 0x001c 00000000 00000000 00000000 00000000 0x0000
 1    pci   can1 90700400 016 0x001c 00000000 00000000 00000000 00000000 0x0000
Regards,
Ian

Re: Linux : Operation not permitted

Posted: Thu 12. Apr 2018, 10:31
by S.Grosjean
Hi,

Setting bitrate generally needs root privileges. Can you tell us the version (or the download source) of the libsocketcan you use, please?

Regards,

Stéphane

Re: Linux : Operation not permitted

Posted: Thu 12. Apr 2018, 16:55
by icarreno
Hi,

This is the information as shown when running locate libsocketcan

Code: Select all

 libsocketcan.so.2.2.1
Thanks.

Re: Linux : Operation not permitted

Posted: Mon 16. Apr 2018, 09:21
by S.Grosjean
Hi,

As I said, while running a Linux System, setting up/down a network interface (as well as setting the bitrate of a can interface) needs root privileges.

Regards,

Stéphane