-
Notifications
You must be signed in to change notification settings - Fork 71
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
best way to programatically test if the module is installed? #66
Comments
Possibly |
Also, when running
. Not sure if there is a way to trigger the registering of the |
You know, you can create a socket without binding it to an address. Seems like it is what you need. Is there an issue I don't know of? |
I thought there might be a cleaner way, but I think that might work. Does this approach work even if there are no CAN interfaces present on the machine? |
yes, the interface is part of the address, which is required to call |
Example here: https://github.com/linux-can/can-utils/blob/master/isotpsend.c#L254-L286 |
I'm trying to figure out a clean way to detect if can-isotp is installed before trying to use it (and potentially getting an error that is not clear if it has to do with a missing module or some other problem).
On first boot
lsmod|grep can_isotp
yields nothing. However, after running
isotprecv -s 123 -d 321 -l can0
I get
So, it looks the the module is loaded automatically on use. I can't figure out how the kernel decides to load modules automatically when needed. Is there a clean way to trigger this to happen manually? I can run
sudo modprobe can_isotp
, but I don't want to do that as root. Somehow theisotprecv
command can do it without being root.I know I could run
to see if it has a modern kernel installed, but I don't think this is a good approach because it seems complicated to parse the kernel version string above with so many variants. Also, people can manually install the kernel module, or have a custom kernel that doesn't have the module installed.
Any suggestions?
I'll be doing this in python by the way, but a solution that works in bash should be general enough for me to port to python.
The text was updated successfully, but these errors were encountered: