Closed nopnop2002 closed 4 years ago
I've added a new branch bugfix/makefile
which should fix the issue for you.
Otherwise run
export KBUILD_NOPEDANTIC=1
./build.sh
Thank you quick response. I made build. It is ok.
$ export KBUILD_NOPEDANTIC=1
$ ./build.sh
Building module
make -C /lib/modules/4.15.0-109-generic/build/ M=/home/nop/usb-can/src/module modules
make[1]: Entering directory '/usr/src/linux-headers-4.15.0-109-generic'
CC [M] /home/nop/usb-can/src/module/hlcan.o
Building modules, stage 2.
MODPOST 1 modules
CC /home/nop/usb-can/src/module/hlcan.mod.o
LD [M] /home/nop/usb-can/src/module/hlcan.ko
make[1]: Leaving directory '/usr/src/linux-headers-4.15.0-109-generic'
Building userpace tools
make: Nothing to be done for 'all'.
But i got error to install.
$ sudo ./build.sh install
Building module
cp hlcan.ko /usr/lib/modules/4.15.0-109-generic/kernel/drivers/net/can
cp: cannot create regular file '/usr/lib/modules/4.15.0-109-generic/kernel/drivers/net/can': No such file or directory
Makefile:15: recipe for target 'install' failed
make: *** [install] Error 1
Building userpace tools
mkdir -p /usr/local/bin
cp -f hlcand /usr/local/bin
I got new branch bugfix/makefile. But same error.
$ git clone -b bugfix/makefile https://github.com/alexmohr/usb-can
Cloning into 'usb-can'...
remote: Enumerating objects: 272, done.
remote: Counting objects: 100% (272/272), done.
remote: Compressing objects: 100% (177/177), done.
remote: Total 371 (delta 164), reused 189 (delta 92), pack-reused 99
Receiving objects: 100% (371/371), 356.14 KiB | 719.00 KiB/s, done.
Resolving deltas: 100% (207/207), done.
$ cd usb-can
$ ./build.sh
Building module
make -C /lib/modules/4.15.0-109-generic/build/ M=/home/nop/usb-can/src/module modules
make[1]: Entering directory '/usr/src/linux-headers-4.15.0-109-generic'
CC [M] /home/nop/usb-can/src/module/hlcan.o
Building modules, stage 2.
MODPOST 1 modules
CC /home/nop/usb-can/src/module/hlcan.mod.o
LD [M] /home/nop/usb-can/src/module/hlcan.ko
make[1]: Leaving directory '/usr/src/linux-headers-4.15.0-109-generic'
Building userpace tools
cc -D_GNU_SOURCE hlcand.c -o hlcand
$ sudo ./build.sh install
Building module
cp hlcan.ko /usr/lib/modules/4.15.0-109-generic/kernel/drivers/net/can
cp: cannot create regular file '/usr/lib/modules/4.15.0-109-generic/kernel/drivers/net/can': No such file or directory
Makefile:15: recipe for target 'install' failed
make: *** [install] Error 1
Building userpace tools
mkdir -p /usr/local/bin
cp -f hlcand /usr/local/bin
I've updated the MakeFile on master. It now creates the folders needed. The bugfix/makefile branch is not actually building how it's supposed to. Therefore do not use this at the moment.
I used master.
I got an error with insmod.
$ git clone https://github.com/alexmohr/usb-can
Cloning into 'usb-can'...
remote: Enumerating objects: 271, done.
remote: Counting objects: 100% (271/271), done.
remote: Compressing objects: 100% (175/175), done.
remote: Total 370 (delta 164), reused 189 (delta 93), pack-reused 99
Receiving objects: 100% (370/370), 356.00 KiB | 154.00 KiB/s, done.
Resolving deltas: 100% (207/207), done.
$ cd usb-can
$ ./build.sh
Building module
make -C /lib/modules/4.15.0-109-generic/build/ M=/home/nop/usb-can/src/module modules
make[1]: Entering directory '/usr/src/linux-headers-4.15.0-109-generic'
CC [M] /home/nop/usb-can/src/module/hlcan.o
Building modules, stage 2.
MODPOST 1 modules
CC /home/nop/usb-can/src/module/hlcan.mod.o
LD [M] /home/nop/usb-can/src/module/hlcan.ko
make[1]: Leaving directory '/usr/src/linux-headers-4.15.0-109-generic'
Building userpace tools
cc -O2 -Wall -Wno-parentheses -D_GNU_SOURCE hlcand.c -o hlcand
$ sudo ./build.sh install
Building module
mkdir -p /usr/lib/modules/4.15.0-109-generic/kernel/drivers/net/can
cp hlcan.ko /usr/lib/modules/4.15.0-109-generic/kernel/drivers/net/can
Building userpace tools
mkdir -p /usr/local/bin
cp -f hlcand /usr/local/bin
$ modprobe can-dev
$ insmod hlcan.ko
insmod: ERROR: could not load module hlcan.ko: No such file or directory
I'm using Bionic Beaver.
$ cat /etc/os-release
NAME="Ubuntu"
VERSION="18.04.4 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.04.4 LTS"
VERSION_ID="18.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=bionic
UBUNTU_CODENAME=bionic
Just load the module with an abosulte path.
sudo insmod /usr/lib/modules/$(uname -r)/kernel/drivers/net/can/hlcan.ko
Just load the module with an abosulte path. But i got this error.
$ sudo insmod /usr/lib/modules/$(uname -r)/kernel/drivers/net/can/hlcan.ko
$ ip link set can0 up
Cannot find device "can0"
$ lsmod | grep hlcan
hlcan 16384 0
can_dev 28672 1 hlcan
Post the result of ip link
$ ip link 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 2: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000 link/ether a0:48:1c:9c:49:c6 brd ff:ff:ff:ff:ff:ff 3: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN mode DEFAULT group default link/ether 02:42:fb:5f:49:6d brd ff:ff:ff:ff:ff:ff
Thank for your support.
I'm going to out.
I can not respond for a while.
The order in the readme was wrong. first start userspace tool then set link up :+1:
I am waiting for you to update the README.
Terminal 1:
$ hlcand -F -s 500000 /dev/ttyUSB0
[6] starting on TTY device /dev/ttyUSB0
ioctl TIOCSETD: Operation not permitted
$ sudo hlcand -F -s 500000 /dev/ttyUSB0
[6] starting on TTY device /dev/ttyUSB0
[5] attached TTY /dev/ttyUSB0 to netdevice
Terminal 2:
$ ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
link/ether a0:48:1c:9c:49:c6 brd ff:ff:ff:ff:ff:ff
3: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN mode DEFAULT group default
link/ether 02:42:fb:5f:49:6d brd ff:ff:ff:ff:ff:ff
4: can0: <NOARP> mtu 16 qdisc noop state DOWN mode DEFAULT group default qlen 10
link/can
$ ip link set can0 up
RTNETLINK answers: Operation not permitted
$ sudo ip link set can0 up
I am sending a CAN frame, but nothing is displayed in Terminal1.
hlcand does not show any output except debug informations.
You wan't to take a look at the kernel CAN utils.
For example run
candump can0
to show traffic.
I understand how USB-CAN works.
Thank you very much.
Thank you for a great job.
I can't build.
My environment:
My USB-CAN Adapter:
Build:
Do you have any advice?