Friday, October 20th 2017, 11:27pm UTC+2

You are not logged in.

  • Login
  • Register

Dear visitor, welcome to SEGGER Forum. If this is your first visit here, please read the Help. It explains how this page works. You must be registered before you can use all the page's features. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

knuta

Beginner

Date of registration: Nov 25th 2012

Posts: 26

1

Saturday, May 6th 2017, 6:36am

[SOLVED] Invalid syntax in /etc/udev/rules.d/99-jlink.rules from JLink_Linux_V614f_x86_64.deb

I recently installed JLink_Linux_V614f_x86_64.deb in Debian Debian GNU/Linux 8.7 (jessie), and discovered that the udev rules never take effect. After some tweaking I have found the following:
  • The file has quite a few Windows newlines in it, which makes those rules be ignored
  • A lot of rules have e.g. ATTR{idProduct}=="0x1001", while the correct format is ATTR{idProduct}=="1001", without the "0x"
  • SUBSYSTEM!="usb_device" should probably be changed to either SUBSYSTEM!="usb" or DEVTYPE!="usb_device"

After making those changes my devices get the correct permissions. I have attached a version of the file which works for me: 99-jlink.rules.txt.

If anyone is testing this at home, a good way of verifying your changes is to run udevadm test --action=add $(udevadm info -q path -n /dev/bus/usb/001/010), where /dev/bus/usb/001/010 is the device name of your J-Link. As soon as the output starts mentioning MODE 0666 you can reload your udev rules using udevadm control --reload.

SEGGER - Niklas

Super Moderator

Date of registration: Oct 6th 2014

Posts: 1,684

2

Monday, May 8th 2017, 12:41pm

Hi,


thanks for your inquiry.

Quoted

The file has quite a few Windows newlines in it, which makes those rules be ignored.

I just gave it a try and indeed, this seems wrong.

Quoted

A lot of rules have e.g. ATTR{idProduct}=="0x1001", while the correct format is ATTR{idProduct}=="1001", without the "0x"
SUBSYSTEM!="usb_device" should probably be changed to either SUBSYSTEM!="usb" or DEVTYPE!="usb_devic


When running the rules you provided, i get the same output as with the original rules file with corrected line ending, except for one warning.

SEGGER rules output:

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
calling: test
version 215
load module index
Network interface NamePolicy= disabled on kernel commandline, ignoring.
timestamp of '/etc/systemd/network' changed
timestamp of '/lib/systemd/network' changed
Parsed configuration file /lib/systemd/network/99-default.link
Created link configuration context.
timestamp of '/etc/udev/rules.d' changed
read rules file: /lib/udev/rules.d/39-usbmuxd.rules
read rules file: /lib/udev/rules.d/40-usb-media-players.rules
read rules file: /lib/udev/rules.d/40-usb_modeswitch.rules
read rules file: /lib/udev/rules.d/42-usb-hid-pm.rules
read rules file: /lib/udev/rules.d/50-bluetooth-hci-auto-poweron.rules
read rules file: /lib/udev/rules.d/50-firmware.rules
read rules file: /lib/udev/rules.d/50-udev-default.rules
read rules file: /lib/udev/rules.d/55-Argyll.rules
read rules file: /lib/udev/rules.d/55-dm.rules
read rules file: /lib/udev/rules.d/56-hpmud.rules
read rules file: /lib/udev/rules.d/60-cdrom_id.rules
read rules file: /lib/udev/rules.d/60-crda.rules
read rules file: /lib/udev/rules.d/60-drm.rules
read rules file: /lib/udev/rules.d/60-fuse.rules
read rules file: /lib/udev/rules.d/60-gnupg.rules
read rules file: /lib/udev/rules.d/60-keyboard.rules
read rules file: /lib/udev/rules.d/60-libgphoto2-6.rules
read rules file: /lib/udev/rules.d/60-libsane.rules
read rules file: /lib/udev/rules.d/60-persistent-alsa.rules
read rules file: /lib/udev/rules.d/60-persistent-input.rules
read rules file: /lib/udev/rules.d/60-persistent-serial.rules
read rules file: /lib/udev/rules.d/60-persistent-storage-dm.rules
read rules file: /lib/udev/rules.d/60-persistent-storage-tape.rules
read rules file: /lib/udev/rules.d/60-persistent-storage.rules
read rules file: /lib/udev/rules.d/60-persistent-v4l.rules
read rules file: /lib/udev/rules.d/61-accelerometer.rules
read rules file: /lib/udev/rules.d/61-gnome-bluetooth-rfkill.rules
read rules file: /lib/udev/rules.d/61-gnome-settings-daemon-rfkill.rules
read rules file: /lib/udev/rules.d/64-btrfs.rules
read rules file: /lib/udev/rules.d/64-xorg-xkb.rules
read rules file: /lib/udev/rules.d/69-cd-sensors.rules
read rules file: /lib/udev/rules.d/69-libmtp.rules
read rules file: /lib/udev/rules.d/69-wacom.rules
read rules file: /lib/udev/rules.d/69-xorg-vmmouse.rules
read rules file: /lib/udev/rules.d/70-power-switch.rules
read rules file: /lib/udev/rules.d/70-printers.rules
read rules file: /lib/udev/rules.d/70-uaccess.rules
read rules file: /lib/udev/rules.d/71-seat.rules
read rules file: /lib/udev/rules.d/73-idrac.rules
read rules file: /lib/udev/rules.d/73-seat-late.rules
read rules file: /lib/udev/rules.d/75-net-description.rules
read rules file: /lib/udev/rules.d/75-persistent-net-generator.rules
read rules file: /lib/udev/rules.d/75-probe_mtd.rules
read rules file: /lib/udev/rules.d/75-tty-description.rules
read rules file: /lib/udev/rules.d/77-mm-cinterion-port-types.rules
read rules file: /lib/udev/rules.d/77-mm-ericsson-mbm.rules
read rules file: /lib/udev/rules.d/77-mm-huawei-net-port-types.rules
read rules file: /lib/udev/rules.d/77-mm-longcheer-port-types.rules
read rules file: /lib/udev/rules.d/77-mm-mtk-port-types.rules
read rules file: /lib/udev/rules.d/77-mm-nokia-port-types.rules
read rules file: /lib/udev/rules.d/77-mm-pcmcia-device-blacklist.rules
read rules file: /lib/udev/rules.d/77-mm-platform-serial-whitelist.rules
read rules file: /lib/udev/rules.d/77-mm-qdl-device-blacklist.rules
read rules file: /lib/udev/rules.d/77-mm-simtech-port-types.rules
read rules file: /lib/udev/rules.d/77-mm-telit-port-types.rules
read rules file: /lib/udev/rules.d/77-mm-usb-device-blacklist.rules
read rules file: /lib/udev/rules.d/77-mm-usb-serial-adapters-greylist.rules
read rules file: /lib/udev/rules.d/77-mm-x22x-port-types.rules
read rules file: /lib/udev/rules.d/77-mm-zte-port-types.rules
read rules file: /lib/udev/rules.d/77-nm-olpc-mesh.rules
read rules file: /lib/udev/rules.d/78-sound-card.rules
read rules file: /lib/udev/rules.d/80-drivers.rules
read rules file: /lib/udev/rules.d/80-mm-candidate.rules
read rules file: /lib/udev/rules.d/80-net-setup-link.rules
read rules file: /lib/udev/rules.d/80-networking.rules
read rules file: /lib/udev/rules.d/80-udisks2.rules
read rules file: /lib/udev/rules.d/85-hplj10xx.rules
read rules file: /lib/udev/rules.d/85-hwclock.rules
read rules file: /lib/udev/rules.d/85-regulatory.rules
read rules file: /lib/udev/rules.d/90-alsa-restore.rules
read rules file: /lib/udev/rules.d/90-libgpod.rules
read rules file: /lib/udev/rules.d/90-pulseaudio.rules
read rules file: /lib/udev/rules.d/95-cd-devices.rules
read rules file: /lib/udev/rules.d/95-udev-late.rules
read rules file: /lib/udev/rules.d/95-upower-csr.rules
read rules file: /lib/udev/rules.d/95-upower-hid.rules
read rules file: /lib/udev/rules.d/95-upower-wup.rules
read rules file: /lib/udev/rules.d/97-hid2hci.rules
read rules file: /etc/udev/rules.d/99-jlink.rules
read rules file: /lib/udev/rules.d/99-systemd.rules
rules contain 393216 bytes tokens (32768 * 12 bytes), 34250 bytes strings
34514 strings (280894 bytes), 30903 de-duplicated (250256 bytes), 3612 trie nodes used
IMPORT builtin 'usb_id' /lib/udev/rules.d/50-udev-default.rules:9
IMPORT builtin 'hwdb' /lib/udev/rules.d/50-udev-default.rules:9
MODE 0664 /lib/udev/rules.d/50-udev-default.rules:41
IMPORT builtin 'hwdb' /lib/udev/rules.d/55-Argyll.rules:88
PROGRAM 'mtp-probe /sys/devices/pci0000:00/0000:00:11.0/0000:02:03.0/usb2/2-1 2 2' /lib/udev/rules.d/69-libmtp.rules:1429
starting 'mtp-probe /sys/devices/pci0000:00/0000:00:11.0/0000:02:03.0/usb2/2-1 2 2'
'mtp-probe /sys/devices/pci0000:00/0000:00:11.0/0000:02:03.0/usb2/2-1 2 2'(out) '0'
'mtp-probe /sys/devices/pci0000:00/0000:00:11.0/0000:02:03.0/usb2/2-1 2 2' [5315] exit with return code 0
MODE 0666 /etc/udev/rules.d/99-jlink.rules:46
handling device node '/dev/bus/usb/002/002', devnum=c189:129, mode=0666, uid=0, gid=0
preserve permissions /dev/bus/usb/002/002, 020666, uid=0, gid=0
preserve already existing symlink '/dev/char/189:129' to '../bus/usb/002/002'
unable to create temporary db file '/run/udev/data/c189:129.tmp': Permission denied
unload module index
Unloaded link configuration context.
This program is for debugging only, it does not run any program
specified by a RUN key. It may show incorrect results, because
some values may be different, or not available at a simulation run.

ACTION=add
BUSNUM=002
DEVNAME=/dev/bus/usb/002/002
DEVNUM=002
DEVPATH=/devices/pci0000:00/0000:00:11.0/0000:02:03.0/usb2/2-1
DEVTYPE=usb_device
DRIVER=usb
ID_BUS=usb
ID_MODEL=J-Link
ID_MODEL_ENC=J-Link
ID_MODEL_ID=0105
ID_REVISION=0100
ID_SERIAL=SEGGER_J-Link_000600101939
ID_SERIAL_SHORT=000600101939
ID_USB_INTERFACES=:020201:0a0000:ffffff:
ID_VENDOR=SEGGER
ID_VENDOR_ENC=SEGGER
ID_VENDOR_FROM_DATABASE=SEGGER
ID_VENDOR_ID=1366
MAJOR=189
MINOR=129
PRODUCT=1366/105/100
SUBSYSTEM=usb
TYPE=239/2/1
USEC_INITIALIZED=389856711


Your rules output:

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
calling: test
version 215
load module index
Network interface NamePolicy= disabled on kernel commandline, ignoring.
timestamp of '/etc/systemd/network' changed
timestamp of '/lib/systemd/network' changed
Parsed configuration file /lib/systemd/network/99-default.link
Created link configuration context.
timestamp of '/etc/udev/rules.d' changed
read rules file: /lib/udev/rules.d/39-usbmuxd.rules
read rules file: /lib/udev/rules.d/40-usb-media-players.rules
read rules file: /lib/udev/rules.d/40-usb_modeswitch.rules
read rules file: /lib/udev/rules.d/42-usb-hid-pm.rules
read rules file: /lib/udev/rules.d/50-bluetooth-hci-auto-poweron.rules
read rules file: /lib/udev/rules.d/50-firmware.rules
read rules file: /lib/udev/rules.d/50-udev-default.rules
read rules file: /lib/udev/rules.d/55-Argyll.rules
read rules file: /lib/udev/rules.d/55-dm.rules
read rules file: /lib/udev/rules.d/56-hpmud.rules
read rules file: /lib/udev/rules.d/60-cdrom_id.rules
read rules file: /lib/udev/rules.d/60-crda.rules
read rules file: /lib/udev/rules.d/60-drm.rules
read rules file: /lib/udev/rules.d/60-fuse.rules
read rules file: /lib/udev/rules.d/60-gnupg.rules
read rules file: /lib/udev/rules.d/60-keyboard.rules
read rules file: /lib/udev/rules.d/60-libgphoto2-6.rules
read rules file: /lib/udev/rules.d/60-libsane.rules
read rules file: /lib/udev/rules.d/60-persistent-alsa.rules
read rules file: /lib/udev/rules.d/60-persistent-input.rules
read rules file: /lib/udev/rules.d/60-persistent-serial.rules
read rules file: /lib/udev/rules.d/60-persistent-storage-dm.rules
read rules file: /lib/udev/rules.d/60-persistent-storage-tape.rules
read rules file: /lib/udev/rules.d/60-persistent-storage.rules
read rules file: /lib/udev/rules.d/60-persistent-v4l.rules
read rules file: /lib/udev/rules.d/61-accelerometer.rules
read rules file: /lib/udev/rules.d/61-gnome-bluetooth-rfkill.rules
read rules file: /lib/udev/rules.d/61-gnome-settings-daemon-rfkill.rules
read rules file: /lib/udev/rules.d/64-btrfs.rules
read rules file: /lib/udev/rules.d/64-xorg-xkb.rules
read rules file: /lib/udev/rules.d/69-cd-sensors.rules
read rules file: /lib/udev/rules.d/69-libmtp.rules
read rules file: /lib/udev/rules.d/69-wacom.rules
read rules file: /lib/udev/rules.d/69-xorg-vmmouse.rules
read rules file: /lib/udev/rules.d/70-power-switch.rules
read rules file: /lib/udev/rules.d/70-printers.rules
read rules file: /lib/udev/rules.d/70-uaccess.rules
read rules file: /lib/udev/rules.d/71-seat.rules
read rules file: /lib/udev/rules.d/73-idrac.rules
read rules file: /lib/udev/rules.d/73-seat-late.rules
read rules file: /lib/udev/rules.d/75-net-description.rules
read rules file: /lib/udev/rules.d/75-persistent-net-generator.rules
read rules file: /lib/udev/rules.d/75-probe_mtd.rules
read rules file: /lib/udev/rules.d/75-tty-description.rules
read rules file: /lib/udev/rules.d/77-mm-cinterion-port-types.rules
read rules file: /lib/udev/rules.d/77-mm-ericsson-mbm.rules
read rules file: /lib/udev/rules.d/77-mm-huawei-net-port-types.rules
read rules file: /lib/udev/rules.d/77-mm-longcheer-port-types.rules
read rules file: /lib/udev/rules.d/77-mm-mtk-port-types.rules
read rules file: /lib/udev/rules.d/77-mm-nokia-port-types.rules
read rules file: /lib/udev/rules.d/77-mm-pcmcia-device-blacklist.rules
read rules file: /lib/udev/rules.d/77-mm-platform-serial-whitelist.rules
read rules file: /lib/udev/rules.d/77-mm-qdl-device-blacklist.rules
read rules file: /lib/udev/rules.d/77-mm-simtech-port-types.rules
read rules file: /lib/udev/rules.d/77-mm-telit-port-types.rules
read rules file: /lib/udev/rules.d/77-mm-usb-device-blacklist.rules
read rules file: /lib/udev/rules.d/77-mm-usb-serial-adapters-greylist.rules
read rules file: /lib/udev/rules.d/77-mm-x22x-port-types.rules
read rules file: /lib/udev/rules.d/77-mm-zte-port-types.rules
read rules file: /lib/udev/rules.d/77-nm-olpc-mesh.rules
read rules file: /lib/udev/rules.d/78-sound-card.rules
read rules file: /lib/udev/rules.d/80-drivers.rules
read rules file: /lib/udev/rules.d/80-mm-candidate.rules
read rules file: /lib/udev/rules.d/80-net-setup-link.rules
read rules file: /lib/udev/rules.d/80-networking.rules
read rules file: /lib/udev/rules.d/80-udisks2.rules
read rules file: /lib/udev/rules.d/85-hplj10xx.rules
read rules file: /lib/udev/rules.d/85-hwclock.rules
read rules file: /lib/udev/rules.d/85-regulatory.rules
read rules file: /lib/udev/rules.d/90-alsa-restore.rules
read rules file: /lib/udev/rules.d/90-libgpod.rules
read rules file: /lib/udev/rules.d/90-pulseaudio.rules
read rules file: /lib/udev/rules.d/95-cd-devices.rules
read rules file: /lib/udev/rules.d/95-udev-late.rules
read rules file: /lib/udev/rules.d/95-upower-csr.rules
read rules file: /lib/udev/rules.d/95-upower-hid.rules
read rules file: /lib/udev/rules.d/95-upower-wup.rules
read rules file: /lib/udev/rules.d/97-hid2hci.rules
read rules file: /etc/udev/rules.d/99-jlink.rules
unknown key 'DEVTYPE' in /etc/udev/rules.d/99-jlink.rules:9
invalid rule '/etc/udev/rules.d/99-jlink.rules:9'
read rules file: /lib/udev/rules.d/99-systemd.rules
rules contain 393216 bytes tokens (32768 * 12 bytes), 34035 bytes strings
34512 strings (280775 bytes), 30926 de-duplicated (250327 bytes), 3587 trie nodes used
IMPORT builtin 'usb_id' /lib/udev/rules.d/50-udev-default.rules:9
IMPORT builtin 'hwdb' /lib/udev/rules.d/50-udev-default.rules:9
MODE 0664 /lib/udev/rules.d/50-udev-default.rules:41
IMPORT builtin 'hwdb' /lib/udev/rules.d/55-Argyll.rules:88
PROGRAM 'mtp-probe /sys/devices/pci0000:00/0000:00:11.0/0000:02:03.0/usb2/2-1 2 2' /lib/udev/rules.d/69-libmtp.rules:1429
starting 'mtp-probe /sys/devices/pci0000:00/0000:00:11.0/0000:02:03.0/usb2/2-1 2 2'
'mtp-probe /sys/devices/pci0000:00/0000:00:11.0/0000:02:03.0/usb2/2-1 2 2'(out) '0'
'mtp-probe /sys/devices/pci0000:00/0000:00:11.0/0000:02:03.0/usb2/2-1 2 2' [5344] exit with return code 0
MODE 0666 /etc/udev/rules.d/99-jlink.rules:46
handling device node '/dev/bus/usb/002/002', devnum=c189:129, mode=0666, uid=0, gid=0
preserve permissions /dev/bus/usb/002/002, 020666, uid=0, gid=0
preserve already existing symlink '/dev/char/189:129' to '../bus/usb/002/002'
unable to create temporary db file '/run/udev/data/c189:129.tmp': Permission denied
unload module index
Unloaded link configuration context.
This program is for debugging only, it does not run any program
specified by a RUN key. It may show incorrect results, because
some values may be different, or not available at a simulation run.

ACTION=add
BUSNUM=002
DEVNAME=/dev/bus/usb/002/002
DEVNUM=002
DEVPATH=/devices/pci0000:00/0000:00:11.0/0000:02:03.0/usb2/2-1
DEVTYPE=usb_device
DRIVER=usb
ID_BUS=usb
ID_MODEL=J-Link
ID_MODEL_ENC=J-Link
ID_MODEL_ID=0105
ID_REVISION=0100
ID_SERIAL=SEGGER_J-Link_000600101939
ID_SERIAL_SHORT=000600101939
ID_USB_INTERFACES=:020201:0a0000:ffffff:
ID_VENDOR=SEGGER
ID_VENDOR_ENC=SEGGER
ID_VENDOR_FROM_DATABASE=SEGGER
ID_VENDOR_ID=1366
MAJOR=189
MINOR=129
PRODUCT=1366/105/100
SUBSYSTEM=usb
TYPE=239/2/1
USEC_INITIALIZED=389856711


What it the expected result?
What was the output for you when using your rules file?

Best regards,
Niklas
Would you like to be added to the J-Link software update notification list, so you get informed automatically when a new version becomes available?
Just write me a PM or in case you want to subscribe to it yourself, please use this link: Link
Notification for J-Link, J-Link Debugger, SystemView & J-Scope: Link
Notification for Embedded Studio: Link

knuta

Beginner

Date of registration: Nov 25th 2012

Posts: 26

3

Wednesday, May 10th 2017, 3:43pm

When running the rules you provided, i get the same output as with the original rules file with corrected line ending, except for one warning.

What it the expected result?
What was the output for you when using your rules file?

Let's go over these one by one and I'll explain my reasoning.

Quoted

A lot of rules have e.g. ATTR{idProduct}=="0x1001", while the correct format is ATTR{idProduct}=="1001", without the "0x"

Its not unlikely that this one is version dependent, and that the "0x" worked at the time it was originally written. I get this output with the 0x format:

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
root@obelisk:~# udevadm test --action=add $(udevadm info -q path -n /dev/bus/usb/001/015)
calling: test
version 215
This program is for debugging only, it does not run any program
specified by a RUN key. It may show incorrect results, because
some values may be different, or not available at a simulation run.

load module index
Network interface NamePolicy= disabled on kernel commandline, ignoring.
timestamp of '/etc/systemd/network' changed
timestamp of '/lib/systemd/network' changed
Parsed configuration file /lib/systemd/network/99-default.link
Created link configuration context.
timestamp of '/etc/udev/rules.d' changed
read rules file: /lib/udev/rules.d/39-usbmuxd.rules
[shortened to avoid exceeding the maximum post length]
read rules file: /etc/udev/rules.d/ols.rules
rules contain 393216 bytes tokens (32768 * 12 bytes), 34800 bytes strings
34598 strings (282174 bytes), 30961 de-duplicated (251012 bytes), 3638 trie nodes used
IMPORT builtin 'usb_id' /lib/udev/rules.d/50-udev-default.rules:9
IMPORT builtin 'hwdb' /lib/udev/rules.d/50-udev-default.rules:9
MODE 0664 /lib/udev/rules.d/50-udev-default.rules:41
RUN '/usr/lib/virtualbox/VBoxCreateUSBNode.sh $major $minor $attr{bDeviceClass}' /etc/udev/rules.d/60-vboxdrv.rules:5
PROGRAM 'mtp-probe /sys/devices/pci0000:00/0000:00:14.0/usb1/1-2 1 15' /lib/udev/rules.d/69-libmtp.rules:1429
starting 'mtp-probe /sys/devices/pci0000:00/0000:00:14.0/usb1/1-2 1 15'
'mtp-probe /sys/devices/pci0000:00/0000:00:14.0/usb1/1-2 1 15'(out) '0'
'mtp-probe /sys/devices/pci0000:00/0000:00:14.0/usb1/1-2 1 15' [1085] exit with return code 0
handling device node '/dev/bus/usb/001/015', devnum=c189:14, mode=0664, uid=0, gid=0
preserve permissions /dev/bus/usb/001/015, 020664, uid=0, gid=0
preserve already existing symlink '/dev/char/189:14' to '../bus/usb/001/015'
ACTION=add
BUSNUM=001
DEVNAME=/dev/bus/usb/001/015
DEVNUM=015
DEVPATH=/devices/pci0000:00/0000:00:14.0/usb1/1-2
DEVTYPE=usb_device
DRIVER=usb
ID_BUS=usb
ID_MODEL=J-Link
ID_MODEL_ENC=J-Link
ID_MODEL_ID=1015
ID_REVISION=0100
ID_SERIAL=SEGGER_J-Link_000682912069
ID_SERIAL_SHORT=000682912069
ID_USB_INTERFACES=:020201:0a0000:ffffff:080650:
ID_VENDOR=SEGGER
ID_VENDOR_ENC=SEGGER
ID_VENDOR_FROM_DATABASE=SEGGER
ID_VENDOR_ID=1366
MAJOR=189
MINOR=14
PRODUCT=1366/1015/100
SUBSYSTEM=usb
TYPE=239/2/1
USEC_INITIALIZED=378852601074
run: '/usr/lib/virtualbox/VBoxCreateUSBNode.sh 189 14 ef'
unload module index
Unloaded link configuration context.


If I remove the "0x", I get this:

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
root@obelisk:~# udevadm test --action=add $(udevadm info -q path -n /dev/bus/usb/001/015)
calling: test
version 215
load module index
Network interface NamePolicy= disabled on kernel commandline, ignoring.
timestamp of '/etc/systemd/network' changed
timestamp of '/lib/systemd/network' changed
Parsed configuration file /lib/systemd/network/99-default.link
Created link configuration context.
timestamp of '/etc/udev/rules.d' changed
read rules file: /lib/udev/rules.d/39-usbmuxd.rules
[shortened to avoid exceeding the maximum post length]
read rules file: /etc/udev/rules.d/ols.rules
rules contain 393216 bytes tokens (32768 * 12 bytes), 34585 bytes strings
34598 strings (282080 bytes), 30986 de-duplicated (251108 bytes), 3613 trie nodes used
IMPORT builtin 'usb_id' /lib/udev/rules.d/50-udev-default.rules:9
IMPORT builtin 'hwdb' /lib/udev/rules.d/50-udev-default.rules:9
MODE 0664 /lib/udev/rules.d/50-udev-default.rules:41
RUN '/usr/lib/virtualbox/VBoxCreateUSBNode.sh $major $minor $attr{bDeviceClass}' /etc/udev/rules.d/60-vboxdrv.rules:5
PROGRAM 'mtp-probe /sys/devices/pci0000:00/0000:00:14.0/usb1/1-2 1 15' /lib/udev/rules.d/69-libmtp.rules:1429
starting 'mtp-probe /sys/devices/pci0000:00/0000:00:14.0/usb1/1-2 1 15'
'mtp-probe /sys/devices/pci0000:00/0000:00:14.0/usb1/1-2 1 15'(out) '0'
'mtp-probe /sys/devices/pci0000:00/0000:00:14.0/usb1/1-2 1 15' [1188] exit with return code 0
MODE 0666 /etc/udev/rules.d/99-jlink.rules:128
handling device node '/dev/bus/usb/001/015', devnum=c189:14, mode=0666, uid=0, gid=0
set permissions /dev/bus/usb/001/015, 020666, uid=0, gid=0
preserve already existing symlink '/dev/char/189:14' to '../bus/usb/001/015'
unload module index
Unloaded link configuration context.
This program is for debugging only, it does not run any program
specified by a RUN key. It may show incorrect results, because
some values may be different, or not available at a simulation run.

ACTION=add
BUSNUM=001
DEVNAME=/dev/bus/usb/001/015
DEVNUM=015
DEVPATH=/devices/pci0000:00/0000:00:14.0/usb1/1-2
DEVTYPE=usb_device
DRIVER=usb
ID_BUS=usb
ID_MODEL=J-Link
ID_MODEL_ENC=J-Link
ID_MODEL_ID=1015
ID_REVISION=0100
ID_SERIAL=SEGGER_J-Link_000682912069
ID_SERIAL_SHORT=000682912069
ID_USB_INTERFACES=:020201:0a0000:ffffff:080650:
ID_VENDOR=SEGGER
ID_VENDOR_ENC=SEGGER
ID_VENDOR_FROM_DATABASE=SEGGER
ID_VENDOR_ID=1366
MAJOR=189
MINOR=14
PRODUCT=1366/1015/100
SUBSYSTEM=usb
TYPE=239/2/1
USEC_INITIALIZED=378852601074
run: '/usr/lib/virtualbox/VBoxCreateUSBNode.sh 189 14 ef'


You'll notice that these are almost identical, but the latter says "MODE 0666 /etc/udev/rules.d/99-jlink.rules:128" while the former does not. What this tells me is that ATTR{idProduct}=="1015" successfully matched my J-Link and set the permissions to 0666, while ATTR{idProduct}=="0x1015" did not.

We appear to be using the same version of udev. However, looking at your output, the device you are testing with has ID_MODEL_ID=0105. This model ID is not affected by my proposed change, since the block of "old format" model IDs didn't have 0x in them in the original file either. My change only affects debuggers using the new format for the model ID, like the one included on the nRF52-DK I am currently playing with.

Quoted

SUBSYSTEM!="usb_device" should probably be changed to either SUBSYSTEM!="usb" or DEVTYPE!="usb_devic

This one wouldn't show any visible difference during this test, since it is only used in this code:

Source code

1
ACTION!="add", SUBSYSTEM!="usb_device", GOTO="jlink_rules_end"

What this presumably attempts to do is to skip all the rules in the file if this is not an "add" action and this is not USB. However, since the match for whether it is USB is using either the wrong variable or the wrong value (depending on what was the desired behavior), the rules are never skipped. This gives no visible difference in this particular test-case (since the action is "add", making the first part of the test not match). It is unclear to me why one would need to skip the rules (I would expect MODE="666" to be a no-op if the file is removed anyway, and merely redundant if the file permissions were already set to that during add), but I assume this was added for a reason. In its current form, it will never match and may as well be deleted if it doesn't add value.

Admittedly, even if you do change this to one of my proposed changes, the logic is still very odd. Since it is an "and" match, the rules would still not be skipped if you were adding a non-USB device, or if you were removing a USB device. It would make more sense to me these were checks for equality and included on each line, like this:

Source code

1
ACTION=="add", DEVTYPE=="usb_device", ATTR{idProduct}=="1015", ATTR{idVendor}=="1366", MODE="666"

However, I have to reiterate that I do not know the intended purpose of the original code.

jdcso

Beginner

Date of registration: May 16th 2017

Posts: 1

4

Tuesday, May 16th 2017, 6:48pm

I am developing on a NXP FRDM-K64 board, J-Link idProduct attribute 1015.
I also had the problem that after installing J-Link v 6.14f I could not start the debugger in Eclipse under Linux. (kubuntu 16.04 in VM on Win7 host.)

The error message was unhelpful, "Connecting to J-Link failed. Connected correctly?"

The installation worked previously with J-Link v. 6.14b so evidently there was some recent problem.
I found that I could start JLinkGDBServer from a root console but not from a user console. My work-around was to set the UID and GID bits on the JLinkGDBServer executable. (sudo chmod ug+s JLinkGDBServer) (The file is installed with ownership root|root.) While this works, it is probably not a desirable fix, since it allows the program to run with root privileges.

After reading the post from knuta I modified the 99-jlink.rules file as suggested, removing the 0x prefix from the idProduct strings.
This resolved the issue and allowed me to restore the permission bits of JLinkGDBServer to the initial values.

Thanks to knuta for finding and posting the info. I believe his/her analysis is correct, that udev fails to match the idProduct attribute due to the 0x prefix in the recent versions of the file. This problem is still observed in J-Link v 6.14h, which is the latest at the time of this posting.

SEGGER - Niklas

Super Moderator

Date of registration: Oct 6th 2014

Posts: 1,684

5

Wednesday, May 17th 2017, 8:44am

Hi,


thanks for the report.
I have not forgotten this, it is still on the todo, but there is no time slot left until next week.
I need to research this - are there differences in the rules implementation etc - so that we fix this only once and not only half-way (or maybe break existing setups).

Best regards,
Niklas
Would you like to be added to the J-Link software update notification list, so you get informed automatically when a new version becomes available?
Just write me a PM or in case you want to subscribe to it yourself, please use this link: Link
Notification for J-Link, J-Link Debugger, SystemView & J-Scope: Link
Notification for Embedded Studio: Link

knuta

Beginner

Date of registration: Nov 25th 2012

Posts: 26

6

Wednesday, May 17th 2017, 9:46am

At first I suspected that the 0x was for an earlier version of udev, but since jdcso reports that it used to work, I took a look at JLink_Linux_V614e_x86_64.deb (the version before the one I had issues with). There I found a shorter list without the 0x:

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#
# 0x1001 - 0x100f not added yet
#
ATTR{idProduct}=="1010", ATTR{idVendor}=="1366", MODE="666"
ATTR{idProduct}=="1011", ATTR{idVendor}=="1366", MODE="666"
ATTR{idProduct}=="1012", ATTR{idVendor}=="1366", MODE="666"
ATTR{idProduct}=="1013", ATTR{idVendor}=="1366", MODE="666"
ATTR{idProduct}=="1014", ATTR{idVendor}=="1366", MODE="666"
ATTR{idProduct}=="1015", ATTR{idVendor}=="1366", MODE="666"
ATTR{idProduct}=="1016", ATTR{idVendor}=="1366", MODE="666"
ATTR{idProduct}=="1017", ATTR{idVendor}=="1366", MODE="666"
ATTR{idProduct}=="1018", ATTR{idVendor}=="1366", MODE="666"
ATTR{idProduct}=="1019", ATTR{idVendor}=="1366", MODE="666"
ATTR{idProduct}=="101A", ATTR{idVendor}=="1366", MODE="666"
ATTR{idProduct}=="101B", ATTR{idVendor}=="1366", MODE="666"
ATTR{idProduct}=="101C", ATTR{idVendor}=="1366", MODE="666"
ATTR{idProduct}=="101D", ATTR{idVendor}=="1366", MODE="666"
ATTR{idProduct}=="101E", ATTR{idVendor}=="1366", MODE="666"
ATTR{idProduct}=="101F", ATTR{idVendor}=="1366", MODE="666"

I suspect the person who expanded the list did so by regenerating it completely using a Windows computer (hence the Windows newlines), and didn't notice that he/she also added an extra "0x" in the ATTR{idProduct}.

SEGGER - Niklas

Super Moderator

Date of registration: Oct 6th 2014

Posts: 1,684

7

Tuesday, June 13th 2017, 9:57am

Hi,


sorry for the long delay in response.
I appreciate your efforts in investigating this issue.
We fixed the issue internally. A fixed public version will be available by the end of this week.


Best regards,
Niklas
Would you like to be added to the J-Link software update notification list, so you get informed automatically when a new version becomes available?
Just write me a PM or in case you want to subscribe to it yourself, please use this link: Link
Notification for J-Link, J-Link Debugger, SystemView & J-Scope: Link
Notification for Embedded Studio: Link

SEGGER - Niklas

Super Moderator

Date of registration: Oct 6th 2014

Posts: 1,684

8

Friday, June 23rd 2017, 7:13pm

Hi Forum,


this issue has been fixed in version 6.16c of the J-Link software & documentation pack.


Best regards,
Niklas
Would you like to be added to the J-Link software update notification list, so you get informed automatically when a new version becomes available?
Just write me a PM or in case you want to subscribe to it yourself, please use this link: Link
Notification for J-Link, J-Link Debugger, SystemView & J-Scope: Link
Notification for Embedded Studio: Link