Skip to content

Commit 639336e

Browse files
authored
Merge pull request #2827 from arduino/sync/taddy/uno-q/udev-rules-update-ref
[PXCT-1610] UNO Q: Linux USB Permissions Update
2 parents 3cf37ac + e7d7e78 commit 639336e

File tree

20 files changed

+416
-0
lines changed

20 files changed

+416
-0
lines changed
49 KB
Loading
193 KB
Loading
37.6 KB
Loading
99.2 KB
Loading
44.9 KB
Loading
131 KB
Loading
193 KB
Loading
49.6 KB
Loading
80.1 KB
Loading

content/hardware/02.uno/boards/uno-q/tutorials/01.user-manual/content.md

Lines changed: 230 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,236 @@ Network Mode relies on **local network discovery (mDNS)** to automatically find
139139
**Note**
140140
Being able to access the board via browser, SSH, or IP address does not guarantee that it will appear in Network Mode. Arduino App Lab uses local network discovery to list boards automatically.
141141

142+
Network Mode relies on **local network discovery (mDNS)** to automatically find boards on the same network. Some network configurations such as guest Wi-Fi, corporate or IoT networks, VPNs, or strict firewall rules may prevent automatic discovery, even if the board is connected to Wi-Fi.
143+
144+
**Troubleshooting Discovery Issues**
145+
146+
* **Windows Users:** When launching Arduino App Lab for the first time, you may receive a prompt from Windows Defender (or other security software) regarding `mdns-discovery.exe`. You must **allow** this access for the board to be discovered. *Note: The prompt may not appear on systems that have already run Arduino IDE at some point.*
147+
* **Firewall Settings:** If the board does not appear, ensure that your firewall allows traffic on **UDP port 5353**, which is required for mDNS discovery.
148+
149+
***__Note__: Being able to access the board via browser, SSH, or IP address does not guarantee that it will appear in Network Mode. Arduino App Lab uses local network discovery to list boards automatically.***
150+
151+
### Linux Host Setup (Required for Linux Users)
152+
153+
If you are using the UNO Q from a Linux host machine, you must configure USB device permissions for your user account. Without proper permissions, several operations may fail, resulting in frustrating errors.
154+
155+
When Arduino App Lab attempts to connect to the board via USB, it will fail silently. You may need to check the DevTools console to see the actual error message about insufficient device permissions.
156+
157+
Similarly, if you try to flash a new image to the board, the process will fail with the following error:
158+
159+
![udev Rules (1)](assets/udev_rules_1.png)
160+
161+
The same error will occur when trying to communicate with the board via ADB commands such as `adb shell`.
162+
163+
<details>
164+
<summary><strong>Click to expand this section</strong></summary>
165+
166+
167+
#### Understanding the Permission
168+
169+
By default, USB devices on Linux are accessible only by the root user or users in specific groups. When the UNO Q connects to your computer, it creates USB device files, typically in the following directory:
170+
171+
```bash
172+
/dev/bus/usb/
173+
```
174+
175+
That requires write permissions for communication.
176+
177+
The UNO Q supports two USB modes, each with its own USB identifier. In regular operation, the board uses USB VID `2341` and PID `0078`.
178+
179+
When you need to flash the board's firmware, it enters **Emergency Download Mode (EDL)**, which uses USB VID `05c6` and PID `9008`. Both modes require proper permissions to function correctly.
180+
181+
#### Installing Udev Rules
182+
183+
The correct way to configure the necessary permissions for your user account is via **udev rules**. `udev` is the Linux subsystem that manages device nodes in the `/dev` directory. The following udev rules will grant your user account access to the UNO Q:
184+
185+
```bash
186+
# Operating mode
187+
SUBSYSTEMS=="usb", ATTRS{idVendor}=="2341", ATTRS{idProduct}=="0078", MODE="0660", TAG+="uaccess"
188+
# EDL mode
189+
SUBSYSTEMS=="usb", ATTRS{idVendor}=="05c6", ATTRS{idProduct}=="9008", MODE="0660", TAG+="uaccess"
190+
```
191+
192+
Run this command to install the necessary udev rules:
193+
194+
```bash
195+
echo \
196+
'# Operating mode
197+
SUBSYSTEMS=="usb", ATTRS{idVendor}=="2341", ATTRS{idProduct}=="0078", MODE="0660", TAG+="uaccess"
198+
# EDL mode
199+
SUBSYSTEMS=="usb", ATTRS{idVendor}=="05c6", ATTRS{idProduct}=="9008", MODE="0660", TAG+="uaccess"' \
200+
| \
201+
sudo \
202+
tee \
203+
"/etc/udev/rules.d/60-Arduino-UNO-Q.rules" \
204+
&& \
205+
sudo \
206+
udevadm control \
207+
--reload-rules \
208+
&& \
209+
sudo \
210+
udevadm trigger
211+
```
212+
213+
![udev Rules (2)](assets/udev_rules_2.png)
214+
215+
This command performs several operations in sequence. First, it creates the rule file and writes the udev rules to:
216+
217+
```bash
218+
/etc/udev/rules.d/60-Arduino-UNO-Q.rules
219+
```
220+
221+
The `60-` prefix determines the rule processing order, where lower numbers indicate higher priority. Files in the `/etc/udev/rules.d/` directory are user-specific overrides that are kept across system updates.
222+
223+
Each rule matches USB devices based on specific criteria. The `SUBSYSTEMS=="usb"` parameter allows the rule to only apply to USB devices.
224+
225+
The `ATTRS{idVendor}` and `ATTRS{idProduct}` parameters identify the UNO Q by its unique USB vendor and product IDs. The `MODE="0660"` parameter sets the device file permissions, allowing the owner and group to read and write to the device.
226+
227+
The `TAG+="uaccess"` parameter grants access to the currently logged-in user through `systemd-logind`.
228+
229+
After creating the rule file, the command reloads all udev rules by running as follows:
230+
231+
```bash
232+
udevadm control --reload-rules
233+
```
234+
235+
![udev Rules (3)](assets/udev_rules_3.png)
236+
237+
This tells udev to reload all rule files without requiring a system restart.
238+
239+
The `udevadm trigger` reprocesses all existing devices with the newly loaded rules, making sure that any currently connected UNO Q boards receive the correct permissions.
240+
241+
#### Verifying the Installation
242+
243+
Using the following command, verify the rules were installed correctly:
244+
245+
```bash
246+
cat /etc/udev/rules.d/60-Arduino-UNO-Q.rules
247+
```
248+
249+
![udev Rules (4)](assets/udev_rules_4.png)
250+
251+
This should display the two udev rules you just installed.
252+
253+
To check if the UNO Q is detected, the following command can be used:
254+
255+
```bash
256+
lsusb | grep -E "2341:0078|05c6:9008"
257+
```
258+
259+
When the board is connected in operating mode, you should see similar to the following output:
260+
261+
![udev Rules (5)](assets/udev_rules_5.png)
262+
263+
#### Applying the Changes
264+
265+
After installing the udev rules, **you need to disconnect and reconnect your board for the changes to take effect**.
266+
267+
Unplug the UNO Q from your computer and wait a few seconds. Then reconnect the board. The new permissions will be applied automatically when the board reconnects.
268+
269+
If you had any applications open when you installed the rules, such as Arduino App Lab or a terminal running ADB commands, you should close and restart them after reconnecting the board. This allows applications to properly detect the board with its new permissions.
270+
271+
For ADB commands, the following commands can be used:
272+
273+
```bash
274+
adb devices
275+
```
276+
277+
This command lists all Android Debug Bridge devices connected to your system. Your UNO Q should appear in the list without any error messages.
278+
279+
The following command can be used to access the UNO Q:
280+
281+
```bash
282+
adb shell
283+
```
284+
285+
![udev Rules (6)](assets/udev_rules_6.png)
286+
287+
#### Alternative Installation Method
288+
289+
You can use the official `post-install` script from the [*Arduino Core Zephyr repository*](https://github.com/arduino/ArduinoCore-zephyr) to configure these permissions automatically. This script performs the same [udev rule installation as the manual method](#linux-users-usb-permissions-required) described above.
290+
291+
To download and run the `post-install` script, navigate to your Downloads directory and use `wget` to fetch the script from the repository:
292+
293+
```bash
294+
cd ~/Downloads
295+
```
296+
297+
```bash
298+
wget https://raw.githubusercontent.com/arduino/ArduinoCore-zephyr/main/post_install.sh
299+
```
300+
301+
![udev Rules (7)](assets/udev_rules_7.png)
302+
303+
```bash
304+
chmod +x post_install.sh
305+
```
306+
307+
```bash
308+
sudo ./post_install.sh
309+
```
310+
311+
![udev Rules (8)](assets/udev_rules_8.png)
312+
313+
If wget is not available on your system, you can use `curl` instead:
314+
315+
```bash
316+
cd ~/Downloads
317+
```
318+
319+
```bash
320+
curl -O https://raw.githubusercontent.com/arduino/ArduinoCore-zephyr/main/post_install.sh
321+
```
322+
323+
```bash
324+
chmod +x post_install.sh
325+
```
326+
327+
```bash
328+
sudo ./post_install.sh
329+
```
330+
331+
```bash
332+
sudo ~/.arduino15/packages/arduino/hardware/zephyr/<version>/post_install.sh
333+
```
334+
335+
Alternatively, you can clone the entire repository and run the script from there:
336+
337+
```bash
338+
cd ~/Downloads
339+
```
340+
341+
```bash
342+
git clone https://github.com/arduino/ArduinoCore-zephyr.git
343+
```
344+
345+
```bash
346+
cd ArduinoCore-zephyr
347+
```
348+
349+
```bash
350+
chmod +x post_install.sh
351+
```
352+
353+
```bash
354+
sudo ./post_install.sh
355+
```
356+
357+
When prompted, enter your password. The script will create the udev rules file, reload the udev rules, and apply them to any currently connected devices, just like the manual installation method.
358+
359+
After running the script, you can verify the installation using the same command shown in the manual installation section:
360+
361+
```bash
362+
cat /etc/udev/rules.d/60-arduino-zephyr.rules
363+
```
364+
365+
![udev Rules (9)](assets/udev_rules_9.png)
366+
367+
Note that the script creates a file named `60-arduino-zephyr.rules` rather than `60-Arduino-UNO-Q.rules`, but it has the same permission rules for both operating modes.
368+
369+
After installing the udev rules using either method, **unplug your UNO Q board from the computer, wait a few seconds, then reconnect it**. This allows the new permissions to be applied. Once reconnected, you can continue to the next steps in the flashing process.
370+
371+
</details>
142372

143373
### Hello World Example
144374

0 commit comments

Comments
 (0)