Allan Smith(deleted)
|
io-pkt driver to implement socketCAN for our hardware issue
|
Allan Smith(deleted)
07/31/2012 10:13 AM
post94529
|
io-pkt driver to implement socketCAN for our hardware issue
I have written a native io-pkt driver for our CAN bus hardware. It seems to be working but when I try to open a socket
and send to it, the data never gets to my network driver.
I start my driver like so:
mount -vvv -Tio-pkt -obaud=1000,port=0,board_index=0,verbose devnp-canpro_g.so
then I assign it an arbitrary IP like so:
ifconfig can0 10.0.0.1
I can see the interface is up from the output of ifconfig
# ifconfig
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 33192
inet 127.0.0.1 netmask 0xff000000
en0: flags=80008843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST,SHIM> mtu 1500
address: 00:50:ba:50:af:6a
media: Ethernet 100baseTX full-duplex
status: active
inet 206.130.75.216 netmask 0xffffff00 broadcast 206.130.75.255
can0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
address: 00:01:02:03:04:05
media: Ethernet autoselect (none full-duplex)
status: active
inet 10.0.0.1 netmask 0xff000000 broadcast 10.255.255.255
then I access the port using my test program like so:
struct can_sockaddr addr;
addr.sa_len = sizeof(addr);
addr.sa_family = AF_INET;
addr.iface = ifaddr;
addr.id = ENDIAN_BE32(0xffe00000);
s = socket(AF_INET, SOCK_RAW, 0);
I know the default protocol is tcpip. Could the tcpip stack be deciding to not route the data to my driver? I have
tried playing with the netmask and using destination IPs like 10.0.0.2 with no luck either.
In the original socketCAN implementation under QNX 6.3 he had a rawcan protocol he used a a upper filter driver. Am I
going to have to make my own to make this work and if so I don't see any samples on how to do this?
Any help would be greatly appreciated.
Thanks
Allan
|
|
|