Lei Luo wrote:

>>> I am a newbie of socketcan, I compiled and installed it in the
> direction of http://dave.limoilux.org/trac/wiki/UseSocketCAN   There are
> two mcp2510 can  controllers in my arm at91rm9200 board.
>>> It failed when run "can_setup start", saying that "cannot creat
> /sys/class/net/can0".
>>
>> If you look in SocketCAN's makefile, did you uncomment export
> CONFIG_CAN_MCP251X=m?
>> You will also need to uncomment export CONFIG_CAN_DEV_SYSFS=y which is
> legacy. 

Yep!

>  
> Yes, I have done it. I used the newest source code from the svn server
> and patched it manually. Configration is as follows:
> CONFIG_CAN=y;
> CONFIG_CAN_RAW=y;
> CONFIG_CAN_BCM=y;
> CONFIG_CAN_GW=y;
> CONFIG_CAN_ISOTP=y;
>  
> CONFIG_CAN_VCAN=y;
> CONFIG_CAN_DEV=y;
> CONFIG_CAN_CALC_BITTIMING=y;
> CONFIG_CAN_MCP251X=y;
>  
>>  
>>>
>>> Then I use "ip link add type vcan" to create the a vcan interface.
> But cmd "add" is not recognised, ip tool is the newest one which is
> compiled with iproute2-2.6.33.tar.bz2. Linux kernel I used is  2.6.28.

Is vcan.ko loaded? Please try

   modprobe vcan

before invoking

   ip link add type vcan

There should be this startup message in the kernel log:
"vcan: Virtual CAN interface driver"

You can see all network interfaces with

   cat /proc/net/dev

or

   ip link show


>  
> The problem of "ip link add" is OK after recompiling kernel,
> /sys/class/net/can0 is created if I type in "ip link add dev can0 type
> vcan". But it says "cannot create /sys/class/net/can0" whenever I did it
> or not.

As said above the sysfs configuration interface is depricated.

For that reason the "can_setup" script is also not usable here.

See

http://lxr.linux.no/#linux+v2.6.33/Documentation/networking/can.txt#L595

for the use of virtual CAN interfaces (that are usually named vcanX).

See

http://lxr.linux.no/#linux+v2.6.33/Documentation/networking/can.txt#L623

for the use of real CAN interfaces (that are usually named canX).

When a 'real' CAN interface driver initializes (like the mcp251x.c) the CAN
drivers allocate device names like can0, can1, can2 ... automatically.

Don't mix that with virtual CAN interfaces that are software instances and
'generated' by "ip link add type vcan"

Regards,
Oliver
_______________________________________________
Socketcan-users mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/socketcan-users

Reply via email to