@@ -2,28 +2,30 @@ Configuration
22=============
33
44
5+ Usually this library is used with a particular CAN interface, this can be
6+ specified in code, read from configuration files or environment variables.
7+
8+ See :func: `can.util.load_config ` for implementation.
59
610In Code
711-------
812
9- The ``can `` object exposes an ``rc `` dictionary which can be used to set the ** interface **
10- before importing from ``can.interfaces ``.
13+ The ``can `` object exposes an ``rc `` dictionary which can be used to set
14+ the ** interface ** and ** channel ** before importing from ``can.interfaces ``.
1115
1216::
1317
1418 import can
1519 can.rc['interface'] = 'socketcan'
20+ can.rc['channel'] = 'vcan0'
1621 from can.interfaces.interface import Bus
17- can_interface = 'vcan0'
18- bus = Bus(can_interface )
22+
23+ bus = Bus()
1924
2025
2126Configuration File
2227------------------
2328
24- Usually this library is used with a particular CAN interface, this can be specified in
25- a configuration file.
26-
2729On Linux systems the config file is searched in the following paths:
2830
29311. ``/etc/can.conf ``
@@ -43,3 +45,35 @@ The configuration file sets the default interface and channel:
4345 interface = <the name of the interface to use>
4446 channel = <the channel to use by default>
4547
48+
49+ Environment Variables
50+ ---------------------
51+
52+ Configuration can be pulled from these environmental variables:
53+
54+ * CAN_INTERFACE
55+ * CAN_CHANNEL
56+
57+
58+ Interface Names
59+ ---------------
60+
61+ Lookup table of interface names:
62+
63+ +---------------------+-------------------------------------+
64+ | Name | Documentation |
65+ +=====================+=====================================+
66+ | ``"socketcan" `` | :doc: `interfaces/socketcan ` |
67+ +---------------------+-------------------------------------+
68+ | ``"kvaser" `` | :doc: `interfaces/kvaser ` |
69+ +---------------------+-------------------------------------+
70+ | ``"serial" `` | :doc: `interfaces/serial ` |
71+ +---------------------+-------------------------------------+
72+ | ``"ixxat" `` | :doc: `interfaces/ixxat ` |
73+ +---------------------+-------------------------------------+
74+ | ``"pcan" `` | :doc: `interfaces/pcan ` |
75+ +---------------------+-------------------------------------+
76+ | ``"usb2can" `` | :doc: `interfaces/usb2can ` |
77+ +---------------------+-------------------------------------+
78+ | ``"virtual" `` | :doc: `interfaces/virtual ` |
79+ +---------------------+-------------------------------------+
0 commit comments