'xinput list' shows same device twice & device IDs change: how to use 'set-prop' in a script?

For some reason Logitech's USB receiver shows up twice in xinput list device list:

Logitech USB Receiver         id=13 [slave  pointer  (2)]
Logitech USB Receiver         id=14 [slave  pointer  (2)]

When I try to xinput set-prop "Logitech USB Receiver" "someSetting" n, I of course get:

Warning: There are multiple devices matching 'Logitech USB Receiver'. To ensure the correct one is selected, please use the device ID, or prefix the device name with 'pointer:' or 'keyboard:' as appropriate.

unable to find device Logitech USB Receiver

The prefix doesn't help as it is the same device (pointer).

I can use the ID instead, but the problem is that the ID of course changes between startups, so I can't makes this automatic (simple script that on startup sets sensitivies for all my pointing decvices).

So, is it possible to remove the duplicate device, make xinput ignore it or still refer to the device by it's name? If neither of these are possible, then I guess a script would have figure out the IDs (and from those, it seems to be always the smaller one).

The commands I want to use are:

xinput set-prop n "Device Accel Constant Deceleration" 2.4
xinput set-prop n "Device Accel Velocity Scaling" 1

Solution 1:

Someone else had a same problem, and someone provided a script solution: https://stackoverflow.com/a/18756948