diff --git a/libevdev/device.py b/libevdev/device.py index 4698580340b30ea9bb7a594407a7c39a7c6e6777..4b54f441ef7c70afda2b1ca36923682ab59f6683 100644 --- a/libevdev/device.py +++ b/libevdev/device.py @@ -284,14 +284,27 @@ class Device(object): @property def id(self): """ - :returns: A dict with the keys 'bustype', 'vendor', 'product', 'version'. + :returns: A dict with the keys ``'bustype'``, ``'vendor'``, + ``'product'``, ``'version'``. When used as a setter, only existing keys are applied to the device. For example, to update the product ID only:: ctx = Device() - id["property"] = 1234 - ctx.id = id + ids = {'product' : 1234} + ctx.id = ids + + You must assign a new dictionary to ``id``. Technical limitations + prohibit accessing the ``id`` dictionary itself for write access. + See this example: :: + + $ ctx = Device() + $ ctx.id['vendor'] = 1234 + $ print(ctx.id['vendor']) + 0 + $ ctx.id = {'vendor': 1234} + $ print(ctx.id['vendor']) + 1234 """ return self._libevdev.id