-
Notifications
You must be signed in to change notification settings - Fork 18k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
x/sys/unix: Add support for SocketCAN #16188
Comments
What's the status on this? Would be great to get this merged. |
This is how we do code review & patch merging: https://golang.org/doc/contribute.html Yes, it's wordy (#17802 tracks shortening it), but it's the only way. |
I will try to follow through with the gerrit submission on the weekend. |
@elliotmr Also, do not forget the BCM Sockets. :) |
@rumpelsepp This change is just for the Sockaddr structure, so that we create the correct socket type, it doesn't even add the can_frame struct let alone the BCM structs. However, there is no problem adding those in a user library because there is no need to access a private interface. |
CL https://golang.org/cl/33392 mentions this issue. |
I am not sure about how to leave a general comment in gerrit, so I will leave it here. I am not exactly sure what to do with the generated files. I ran mkall.sh on my development computer which is amd64 and on a qemu emulated arm system. However, both results were substantially different in all the ztypes__, zsysnum__, and zerrors_* files. I ended up cherry picking the relevant changes for ztypes from the generation and I left out the rest of the changes. Is this the correct approach? Also, I don't have the infrastructure to regenerate all the architectures, how is this normally handled? |
Cherry picking the required changes is the right approach. Do the types and numbers vary across architectures? |
As far as I understand, everything should be architecture independent. I can just copy the generated code to the other architecture specific files if that is the way to go. |
Yes, that is fine. Thanks. |
set can filter frame
|
@axlrose I'm not sure what you are trying to say, but this issue is closed. Please use a form (https://golang.org/wiki/Questions) or open a new issue. |
The unix.Sockaddr interface has a package local method and therefore cannot be implemented outside of the golang.org/x/sys/unix package, and without an appropriate Sockaddr structure for CAN it is impossible to create a SocketCAN socket type. (See discussion here: https://groups.google.com/forum/#!topic/golang-nuts/5HTN3QVC_lQ).
The proposal is to add a SockaddrCAN struct for wrapping the sockaddr_can structure defined in <linux/can.h> so that SocketCAN can use all the socket related functions from the package.
Patch: https://github.com/elliotmr/cantest/blob/master/unix.diff
Test Code: https://github.com/elliotmr/cantest
The text was updated successfully, but these errors were encountered: