From mboxrd@z Thu Jan 1 00:00:00 1970 From: Oliver Hartkopp Subject: Re: kvaser leaf and SocketCAN Date: Thu, 30 Apr 2015 09:27:30 +0200 Message-ID: <5541D962.5040103@hartkopp.net> References: <553755E8.20704@pengutronix.de> <55406A03.9060105@pengutronix.de> <20150429104528.GA5712@linux> <5541D057.2020003@pengutronix.de> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Return-path: Received: from mo4-p00-ob.smtp.rzone.de ([81.169.146.219]:44773 "EHLO mo4-p00-ob.smtp.rzone.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751140AbbD3H2Q (ORCPT ); Thu, 30 Apr 2015 03:28:16 -0400 In-Reply-To: <5541D057.2020003@pengutronix.de> Sender: linux-can-owner@vger.kernel.org List-ID: To: Leo Stan , linux-can@vger.kernel.org Cc: Marc Kleine-Budde On 30.04.2015 08:48, Marc Kleine-Budde wrote: > On 04/30/2015 08:14 AM, Leo Stan wrote: >> close(s); >> >> return 0; >> } >> >> I get this flag : >> >> can0 at index 3 >> can raw socket read: Network is down > ^^^^^^^^^^^^^^^ > You have to configure your CAN network device first, then bring it into > an operational state, this means the network is "up". > > ip link set can0 type can bitrate 500000 > ip link set can0 up > > See section "6.5.1 Netlink interface to set/get devices properties" > http://lxr.free-electrons.com/source/Documentation/networking/can.txt#L990 > Yes. Stan: please download https://github.com/linux-can/can-utils compile and install them (make && make install) or with autotools. And use 'cansend' and 'candump' to check whether its working. On recent Debian / Ubuntu you can try apt-get install can-utils Programming your own stuff makes sense when you have a working CAN setup. But when you are fighting on the basic driver side *and* the userspace apps it becomes very hard. There are also code examples in https://github.com/linux-can/can-tests which will help you more than the Wikipedia code sniplet. And read https://www.kernel.org/doc/Documentation/networking/can.txt which Marc already suggested. Best regards, Oliver