-
Notifications
You must be signed in to change notification settings - Fork 5
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
Merge latest version of gs_usb.c in #3
base: master
Are you sure you want to change the base?
Conversation
This should make the driver closer to mainline for upstreaming purposes
Awesome work! Do you have any thoughts on how to make this driver work with both FD and non-FD devices? Or do you think it's best to try and get it merged in as a separate driver? To have a common driver, I think we would need an FD and a non-FD host frame that is used depending on the FD feature flag and whether a message is FD or classic CAN. This would save bit time on the wire as classic messages would not get sent over USB with a full FD-length host frame. Does this seem possible / does this seem like a good approach? |
The driver already does a feature-detect phase where it will automatically enable/disable FD support if it finds the dongle supports it. So I think it should be possible to merge it into the existing gsusb driver with minimal changes. I don't know about the host frame - I think if you're sending non-FD packets, then the last 56 bytes will just not be sent/received. It's a bit weird to have a structure that you're not fully sending, so maybe having two structures would make more sense (or at least make it more readable/explicit). One concern is just that there is no GSUSB standard - so Cantact Pro has just said that bit 8 is the feature flag. But we might start getting incompatible with other dongles in the future, like the candlelightfw group? To be honest, I evaluated the Cantact Pro for its FD support, but it was dropping packets, and I didn't get much feedback on the issue from Linklayer, so I've moved on to using a different (more expensive & proprietary) dongle. I'd love to switch back, but at the moment I don't think its likely. |
In the current state of the driver the whole 64 byte array will be sent and classical candlelight firmware support is broken right now with this PR. This implementation works, but basically I also don't like the idea of sending only parts of the gs_host_frame, but all other options would require to rewrite big parts of the driver, because it is not so easy to use the two different structs in parallel. If you decide at runtime which struct you use, you can't access the struct elements by their names if you have some void pointer to one of two structs...or at least I'm currently not aware of another clever solution to this problem. Ideas welcome. And submitting as a separate FD driver is no valid option IMHO, because the drivers are almost the same.
I don't think that's a big issue, because if nothing is documented right now then it's free to use. We also added another feature bit to request the nxp errata workaround. This would have to be backported to cantact pro, but I think that's the best solution for this bug. |
@AndreRenaud there are small differences in our versions, but would you mind if I add your singed-off-by tag to pfink-christ/net-next@c7daf3e as well? |
@pfink-christ Yes, the changes you've got there look like the best minimal set to get just the FD feature merged in. As you say however, it does end up transferring the full new |
Hi all, Great to see there is progress on this. I've also created hardware that currently leverages the GS_USB driver. I've been keeping a keen eye on this repository as a basis for interfacing with CAN FD. I've thought about creating my own driver but with so many existing drivers for CAN devices it's my opinion that we all need to decide on one.
I agree with this, however, I'm not sure everyone will see this the same way. As it was originally a driver for Geschwister Schneider CAN devices, it might be harder for us to push this driver to the mainline without having any connection to the original device the driver was created for. It may be easier for us to push this as a new driver that we can maintain/improve as a group without effecting the existing Geschwister Schneider driver. I'd love to be able to make this driver not restricted to certain VID/PIDs too so that other people can create their own hardware and easily interface with this driver without performing kernel patches or creating rules to overwrite VID/PID. However, to my knowledge, there is no easy way of doing this (happy to be corrected though). @pfink-christ I see that you've added your VID/PID to your version of the driver. Would you mind if I submit a PR to add mine too? Happy to help out where I can on this and assist in getting this into mainline, even if it's just assisting with documentation. Is there a discussion board or group where we can all keep in touch and discuss our ideas/progress further? Cheers |
Hi @BennyEvans,
There is no way around it. That's the way usb driver recognition works...look at other drivers, there are tens and more VID/PID combinations for compatible devices - e.g. here is one I know of -> https://github.com/torvalds/linux/blob/136057256686de39cc3a07c2e39ef6bc43003ff6/drivers/net/usb/asix_devices.c#L1261
Above all testing is always welcome. But I think first priority should be to find another way of implementing the "switch" between classic can and FD. Because that is the one thing currently keeping me from sending the patches to ML for review and my time is rather limited at the moment. Could we move further mainlining discussions to -> #2? |
This should make the driver closer to mainline for upstreaming purposes
A better way to view this change is to get the latest checkout of linux mainline, and do a diff from drivers/net/can/usb/gs_usb.c to gs_usb_fd.c.
See here for that diff: https://gist.github.com/AndreRenaud/c2f3848eccbc8375d390f961b43673cf