kwindrem / VeCanSetup

Manages Victrion VenusOs VeCan (aka CANbus) ports
46 stars 6 forks source link

Venus changes #6

Open jhofstee opened 2 years ago

jhofstee commented 2 years ago

Just to drop you a note, since Venus v2.90~17 there is no longer a limit for 2 CAN-bus interfaces. Services will now be automatically created for new CAN interfaces. You can name them from udev if you like, see https://github.com/victronenergy/meta-victronenergy/commit/e9ba4487c2997f021e7548ddea5e0b16c15bb46c. And slcan no longer needs the bitrate.

There is a script as well in /opt/victronenergy/venus-platform/svectl to install services.

Feel free to close this issue, since it actually isn't an issue, just a note...

kwindrem commented 2 years ago

Is there documentation for this somewhere? I'd like to update my VeCanSetup package to support more than 2 CAN ports. Is there a practical limit to the number of CANbus ports?

Thanks.

jhofstee commented 2 years ago

No better, we have code ;), see below.

There is no longer a need to set the bitrate for slcan with -s. An optional name can be set for a CAN-bus interface. There is no longer any limit on the number of CAN-interfaces.

https://github.com/victronenergy/linux/commits/venus-5.10.109 https://github.com/victronenergy/meta-victronenergy/commit/e9ba4487c2997f021e7548ddea5e0b16c15bb46c

kwindrem commented 2 years ago

Do these changes obsolete VeCanSetup? Sorry, I it isn't clear from the links you sent if VeCanSetup will have any value after v2.90~17 and can't look at the code for this release since it's no longer on the development branch and I didn't snag a copy when it was there.

Just want to do the right thing here.

kwindrem commented 2 years ago

[EDIT]

I've been doing a lot of work with v2.90~18 and believe I have a working system.

I have hot-plug working. I needed to add 'udevadm trigger -y can[port number]' to the add script.

I have discovered Venus OS configures some ports automagically. That's essentially USB devices that do not use slcand. This automatic configuration was in conflict with manual configuration of each port as was done prior to v2.90~18. If a port was configured automatically, any udev rules installed by VeCanSetup were ignored. So I had to insure that any ports configured by VeCanSetup did not use the same port identifiers. To do so, the first port I configure via VeCanSetup is can10. That means ports between can0 and can9 are up for built-in ports or automatic configuration by Venus OS. Ports can10 - can 19 are configured by VeCanSetup.

Interface names aren't working. According to comments by jhofstee I should be able to add VE_NAME to the udev rules but this isn't changing the name seen in the Service menu. Still just the port identifier (can0).

For ports using slcand this is because the device port runs slcand which creates a second port that becomes the CANbus interface for the rest of the system. The device port ends up with a name like ttyACM0. Parameters attached to udev for the device port aren't transferred to the port (can0) used by the rest of the system. Once that second port is created, there is no way to add parameters to it.

For ports that don't use slcand an are automatically configured, the OS provides no mechanism to set the name.

I'd like someone at Victron to confirm what I'm doing is correct. If not, what's the correct way?

I have placed a test version on GitHub for evaluation by others:

https://github.com/kwindrem/VeCanSetup/tree/beta

claib commented 2 years ago

Hi there I'm playing around with my 2.9 22 version on my Raspi. Done the script steps. Seems to be fine. grafik On the Remote Web Interface i see no Service .... Are there compat issues ? best Christoph

kwindrem commented 2 years ago

The "latest" version of VeCanSetup is not compatible with v2.90 due to the changes in the way Venus OS now handles CANbus ports.

There is a beta version of VeCanSetup available but I'm still working on several issues. I have not had the opportunity to test with any of the CANbus hats but have reports of them working pre v2.90 for others.

claib commented 2 years ago

thank you very much for your valuable time and effort !