You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
| `privileged` | Root privileges | `true` | Root privileges are **required** to write to `/sys/` (see issue [#22825](https://github.com/moby/moby/issues/22825) for details).
92
+
All commands assume that the container is named `rudy-client`.
93
+
94
+
| Action | Command
95
+
| ------ | -------
96
+
| Start the client | `docker-compose up -d`
97
+
| Stop the client | `docker-compose down`
98
+
| View the client logs | `docker logs -t rudy-client`
99
+
| Reload the client | `docker exec rudy-client reload`
100
+
| List devices currently managed by the client | `docker exec rudy-client usbip port`
| `volumes` | Volume for port state | `/var/run/vhci_hcd:/var/run/vhci_hcd` | USB/IP manages the state of attached ports within this directory. It reflects a part of the kernel state which affects all clients and should thus be shared across the host and all clients.
106
+
| `privileged` | Root privileges | `true` | Root privileges are **required** to write to `/sys/` (see issue [#22825](https://github.com/moby/moby/issues/22825) for details).
| `USBIP_SERVER` | USB/IP server hostname | Hostnames | _none_ | `server-host` | Hostname of the USB/IP server
114
+
| `USBIP_PORT` | USB/IP server port | IP port numbers | 3240 | `13240` | Port of the USB/IP server
115
+
| `USBIP_DETACH_ORPHANS` | Detach dangling ports | `true` / `false` | `true` | `false` | When set to `true` (which is the default), all attached devices that match `USBIP_DEVICE_IDS` are detached on shutdown. This option has no effect when `USBIP_DEVICE_IDS` is not set. It can help to repair the USB/IP state when client and server are not in sync.
116
+
| `USBIP_DETACH_ALL` | Detach all ports | `true` / `false` | `false` | `true` | When set to `true`, all attached devices are detached on shutdown, no matter what their device id or bus id is. This option affects all clients on a host. It is safe to use when the host runs only one client; otherwise, all clients should be reloaded after the client which has this option set.
| `USBIP_DEVICE_IDS` | List of USB device IDs | `0000:0000,1111:1111` | Comma-separated device id list of managed USB devices (format VID:PID). This option does not support more than one device per ID.
111
-
| `USBIP_BUS_IDS` | List of USB bus IDs | `1-1.1,2-2.2` | Comma-separated id list of managed USB devices (format: logical bus ID). This option can be used to use multiple devices with the same device id. The logical bus id of a device will change when it is plugged into a different USB port.
112
-
| `USBIP_DEBUG` | Enable debug logging | `true` | When this option is set to any non-empty value, debug logging is enabled.
| `USBIP_DEVICE_IDS` | List of USB device IDs | `VID:PID` list | _none_ | `0000:0000,1111:1111` | Comma-separated Device-ID list of managed USB devices. This option does not support more than one device per ID.
122
+
| `USBIP_BUS_IDS` | List of USB bus IDs | List of logical Bus IDs | _none_ | `1-1.1,2-2.2` | Comma-separated ID list of managed USB devices. This option can be used to use multiple devices with the same Device-ID. The logical Bus-ID of a device will change when it is plugged into a different USB port.
123
+
| `RUDY_DEBUG` | Enable debug logging | String | _none_ | `true` | When this option is set to any non-empty value, debug logging is enabled.
124
+
| `RUDY_TRACE` | Enable trace logging | String | _none_ | `true` | When this option is set to any non-empty value, trace logging is enabled.
125
+
| `MQTT_OPTIONS` | Common MQTT options | All options [supported by `mosquitto_pub`](https://mosquitto.org/man/mosquitto_pub-1.html) | _none_ | `-h broker-host -i rudy-client` | Default MQTT options for both publish and subscribe
126
+
| `MQTT_PUBLISH_TO_TOPIC` | MQTT topic for publishing | [Topic names](http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Toc398718106) | _none_ | `rudy/client` | When this option is set, the service will publish its state below the configured topic.
127
+
| `MQTT_PUBLISH_OPTIONS` | MQTT options for publish | All options [supported by `mosquitto_pub`](https://mosquitto.org/man/mosquitto_pub-1.html) | _none_ | `-q 1` | MQTT options for publishing only. This option overrides `MQTT_OPTIONS`: when set, `MQTT_OPTIONS` is ignored for publishing.
128
+
| `MQTT_RELOAD_ON_TOPIC` | MQTT topic for a reload hook | [Topic names](http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Toc398718106) | _none_ | `rudy/server/start` | When this option is set, the service will subscribe to the configured topic and reload if a message is published to it.
129
+
| `MQTT_SUBSCRIBE_OPTIONS` | MQTT options for subscribe | All options [supported by `mosquitto_pub`](https://mosquitto.org/man/mosquitto_pub-1.html) | _none_ | `-q 2` | MQTT options for subscribing only. This option overrides `MQTT_OPTIONS`: when set, `MQTT_OPTIONS` is ignored for subscribing.
113
130
114
131
Only one of `USBIP_DEVICE_IDS` and `USBIP_BUS_IDS` is required; when both variables are given, `USBIP_BUS_IDS` is preferred.
115
132
@@ -124,27 +141,78 @@ On debian-based systems, `docker-compose` may be installed by calling
124
141
$ sudo apt install docker-compose
125
142
```
126
143
127
-
## Pitfalls
128
-
### Connection issues
129
-
When the server is stopped, a connected client loses all managed devices silently.
130
-
This scenario may be verified by requesting the list of imported USB devices on the client, which is empty in this case:
131
-
```shell
132
-
$ docker-compose exec usbip-client usbip port
133
-
Imported USB devices
134
-
====================
135
-
$ _
136
-
```
137
-
138
-
To reconnect after the server is up again, run on the client:
139
-
140
-
```shell
141
-
$ docker-compose exec usbip-client restart
142
-
```
143
-
After that, the list of managed devices should be no longer empty:
144
-
```shell
145
-
$ docker-compose exec usbip-client usbip port
146
-
Imported USB devices
147
-
====================
148
-
Port 00: <Port in Use> at High Speed(480Mbps)
149
-
...
150
-
```
144
+
## Advanced topics
145
+
### MQTT publishing
146
+
Configure `MQTT_PUBLISH_TOPIC` to publish client and server states via MQTT.
147
+
148
+
Example:
149
+
- Server configuration:
150
+
```yaml
151
+
environment:
152
+
USBIP_DEVICE_IDS: "4971:1011"
153
+
MQTT_PUBLISH_TOPIC: "rudy/server"
154
+
```
155
+
- Client configuration:
156
+
```yaml
157
+
environment:
158
+
USBIP_DEVICE_IDS: "4971:1011"
159
+
MQTT_PUBLISH_TOPIC: "rudy/client"
160
+
```
161
+
- MQTT messages published on starting server and client and then stopping client and server:
0 commit comments