Project Home
Project Home
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
BroadcastCommunity.qnx.com will be offline from May 31 6:00pm until June 2 12:00AM for upcoming system upgrades. For more information please go to https://community.qnx.com/sf/discussion/do/listPosts/projects.bazaar/discussion.bazaar.topc28418
Forum Topic - io-pkt driver to implement socketCAN for our hardware issue: Page 1 of 3 (3 Items)
   
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