Alexandre Vézina wrote:
> Sorry for the "reply to all" problem..
>
> On Tue, Oct 27, 2009 at 2:20 PM, Wolfgang Grandegger
> <[email protected]>wrote:
>
>>>> Does this problem show up with CONFIG_CAN_DEV_SYSFS=y?
>>>>
>>> No actually it doesn't thanks.
>>>
>>> But I have another problem. Again I get a segfault while calling *rmmod*.
>>>
>>> I looked at the resource flags at different point in the code and I found
>>> out that they were still ok at the end of the *init *function (but not in
>>> exit or remove).
>>>
>>> So I did:
>>> *modprobe tscan1
>>> echo 1000 > /sys/class/net/can0/tx_queue_len
>>> echo 12500 > /sys/class/net/can0/can_bittiming/bitrate
>>> ip link set can0 up type can*
>>>
>>> I then saw that the resource flags were set to a wrong value (like
>>> 102840504) in the *write_reg *function (after setting the can0
>> interface).
>>> Do you know what is happening between the end of *init* and the moment
>> that
>>> *write_reg *is called?
>>
>> static int __init tscan1_init(void)
>> {
>> int irq;
>> void *reg_end;
>> struct resource tscan1_res[2];
>>
>> Shouldn't there be a "static" in front of "struct resource
>> tscan1_res[2];". Does it fix your problem?
>>
>
> Thanks a lot it worked, but can you explain (or point me what to look for
> :P) why this struct needs to be declared static. I do not understand what is
> wrong there so I don't know where to search...
If you don't declare the variable static, the address is only valid
within the function. But you reference it later-on in other function(s)
as well.
> I tried can{ gen | dump }ing and it seems that write_reg is never called.
>
> Calling *ip link set can0 type can bitrate 125000* gives the output:
> *RTNETLINK answers: Operation not supported*
>
> I am really confused about the role of RTNELINK vs iproute2 (compiled from
> git if it can help).
Either you use the SysFS *or* the netlink interface. These are two
different interfaces to configure the CAN devices. If you are using the
SysFS interface, you should write to the relevant SysFS files as you do
above and use ifconfig to start/stop the device:
# echo 12500 > /sys/class/net/can0/can_bittiming/bitrate
# ifconfig can0 up
The problems you see with the netlink interface have been reported with
2.6.27 as well. I will debug them when time permits.
Wolfgang.
_______________________________________________
Socketcan-users mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/socketcan-users