question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

cantools.database.can.bus.py only used for .kcd parsing (need .dbc support)

See original GitHub issue

Hi,

Currently the database created from a .dbc file is always created sith an empty buses list. See https://github.com/eerimoq/cantools/blob/4bde521fb35787776092d6ec31dc1356e4b3c35a/cantools/database/can/formats/dbc.py#L1352-L1356

However, information about the bus can be found in the DBC. For instance in the one I’m using:

Bus name:

BA_DEF_  "DBName" STRING ;
BA_DEF_DEF_  "DBName" "";
BA_ "DBName" "Infotainment_AmplifierCAN";

Bus baudrate:

BA_DEF_  "Bauderate" INT 0 1000000;
BA_DEF_DEF_  "Bauderate" 125000;
BA_ "Bauderate" 125000;

Is it possible to add at least a Bus() in the list with the following info?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
anxuaecommented, Apr 5, 2019

Thanks a lot. No matter of the default value, I did it only to be consistent with KCD parser.

0reactions
eerimoqcommented, Apr 4, 2019

I added tests and refactored a bit.

There was a comment that the default baudrate was copied from kcd.py. I changed the default baudrate to None, or unavailable. Let me know if it should be 500000 instead and I’ll change it back.

Read more comments on GitHub >

github_iconTop Results From Across the Web

CAN BUS tools — cantools 34.3.0 documentation
CAN BUS tools in Python 3. DBC, KCD, SYM, ARXML 4 and CDD file parsing. CAN message encoding and decoding. Simple and extended...
Read more >
cantools Documentation - Read the Docs
CAN BUS tools in Python 3. • DBC, KCD, SYM, ARXML 4 and CDD file parsing. • CAN message encoding and decoding.
Read more >
cantools - PyPI
CAN BUS tools in Python 3. DBC, KCD, SYM, ARXML 3&4 and CDD file parsing. CAN message encoding and decoding. Simple and extended...
Read more >
cantools/test_database.py at master - GitHub
"""Encode and decode a message without scaling the signal values. """ db = cantools.
Read more >
How to use the cantools.database function in cantools - Snyk
To help you get started, we've selected a few cantools.database examples, based on popular ways it is used in public projects.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found