summaryrefslogtreecommitdiff
path: root/src/udev
AgeCommit message (Collapse)Author
2015-05-03udevd: don't unref worker objects on SIGSTOP/SIGCONTTom Gundersen
We should not be receiving these anyway, but let's be correct. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-05-03udevd: warn if we receive SIGCHLD from untracked workerTom Gundersen
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-05-03udevd: improve logging in SIGCHLD handlingTom Gundersen
Remove some redundant logging, and reduce the log-level in most cases. The only case that is really critical is if a worker failed while hanlding an event, so keep that at error level.
2015-05-03udev: event - update tags before writing out dbTom Gundersen
The old tags are read from the db when deciding which tags to clear, make sure we don't write out the new db before the old one has been read. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-05-03udev: Fix ping timeout when settle timeout is 0Nir Soffer
When running udevadm settle --timeout=0, the ping always times out, and udevadm will return 0 without checking the queue state. (David: Use a reasonable timeout to still get the barrier provided by ctrl-ping) Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-05-03udevadm: enclose invocation of unlinkat() with a (void) castLennart Poettering
Let's make Coverity happy about this one. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-05-03udev: settle should return immediately when timeout is 0Nir Soffer
udevadm manual says: A value of 0 will check if the queue is empty and always return immediately. However, currently we ignore the deadline if the value is 0, and wait without any limit. Zero timeout behaved according to the documentation until commit ead7c62ab7 (udevadm: settle - kill alarm()). Looking at this patch, it seems that the behavior change was unintended. This patch restores the documented behavior. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-05-03udev-builtin-usb_id: fix inverted conditionZbigniew Jędrzejewski-Szmek
Fix for 4beac74e69. Thanks, Ronny! Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-05-03udev-builtin-usb_id: simplificationZbigniew Jędrzejewski-Szmek
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-05-03udev: downgrade a few warnings to debug messagesLennart Poettering
https://bugs.freedesktop.org/show_bug.cgi?id=89885 Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-05-03input_id: Identify scroll-wheel device on Trust TB7300 tablet as keyboardHans de Goede
The Trust TB7300 (relabelled Waltop?) tablet has a scrollwheel which shows up as a /dev/input/event# node all by itself. Currently input_id does not set any ID_INPUT_FOO attr on this causing it it to not be recognized by Xorg / libinput. This commit fixes this by marking it with ID_INPUT_KEY. Reported-by: Sjoerd Timmer <themba@randomdata.nl> Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-05-03udev: input_id: Make test_pointer / test_keys return if they've found anythingHans de Goede
Make test_pointer / test_keys return a boolean indicating whether or not they've set any properties on the device. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-05-03udev: input_id: whitespace fixesPeter Hutterer
Remove whitespaces before opening parentheses, mostly before test_bit. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-05-03udev: keyboard-builtin: Add support for setting IBM trackpoint sensitivityHans de Goede
IBM / Lenovo trackpoints allow specifying a sensitivity setting through a ps/2 command, which changes the range of the deltas sent when using the trackpoint. On some models with normal usage only deltas of 1 or 2 are send, resulting in there only being 2 mouse cursor movement speeds, rather than the expected fluid scale. Changing the sensitivity to a higher level than the bootup default fixes this. This commit adds support for setting a POINTINGSTICK_SENSITIVITY value in hwdb to allow changing the sensitivity on boot through udev / hwdb. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-04-12udev-builtin-keyboard: make error messages more standardZbigniew Jędrzejewski-Szmek
- No need to add "Error, " prefix, we already have that as metadata. - Also use double quotes for path names, as in most other places. - Remove stray newline at end of message. - Downgrade error messages after which we continue to warnings. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-04-12udevd: fix synchronization with settle when handling inotify eventsDaniel Drake
udev uses inotify to implement a scheme where when the user closes a writable device node, a change uevent is forcefully generated. In the case of block devices, it actually requests a partition rescan. This currently can't be synchronized with "udevadm settle", i.e. this is not reliable in a script: sfdisk --change-id /dev/sda 1 81 udevadm settle mount /dev/sda1 /foo The settle call doesn't synchronize there, so at the same time we try to mount the device, udevd is busy removing the partition device nodes and readding them again. The mount call often happens in that moment where the partition node has been removed but not readded yet. This exact issue was fixed long ago: http://git.kernel.org/cgit/linux/hotplug/udev.git/commit/?id=bb38678e3ccc02bcd970ccde3d8166a40edf92d3 but that fix is no longer valid now that sequence numbers are no longer used. Fix this by forcing another mainloop iteration after handling inotify events before unblocking settle. If the inotify event caused us to generate a "change" event, we'll pick that up in the following loop iteration, before we reach the end of the loop where we respond to settle's control message, unblocking it. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-04-12udev: restore udevadm settle timeoutNir Soffer
Commit 9ea28c55a2 (udev: remove seqnum API and all assumptions about seqnums) introduced a regresion, ignoring the timeout option when waiting until the event queue is empty. Previously, if the udev event queue was not empty when the timeout was expired, udevadm settle was returning with exit code 1. To check if the queue is empty, you could invoke udevadm settle with timeout=0. This patch restores the previous behavior. (David: fixed timeout==0 handling and dropped redundant assignment) Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-04-12udev: builtin-keyboard: add support for EVDEV_ABS_*Anthony G. Basile
Parse properties in the form EVDEV_ABS_00="<min>:<max>:<res>:<fuzz>:<flat>" and apply them to the kernel device. Future processes that open that device will see the updated EV_ABS range. This is particularly useful for touchpads that don't provide a resolution in the kernel driver but can be fixed up through hwdb entries (e.g. bcm5974). All values in the property are optional, e.g. a string of "::45" is valid to set the resolution to 45. The order intentionally orders resolution before fuzz and flat despite it being the last element in the absinfo struct. The use-case for setting fuzz/flat is almost non-existent, resolution is probably the most common case we'll need. To avoid multiple hwdb invocations for the same device, replace the hwdb "keyboard:" prefix with "evdev:" and drop the separate 60-keyboard.rules file. The new 60-evdev.rules is called for all event nodes anyway, we don't need a separate rules file and second callout to the hwdb builtin. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-04-12udev: builtin-keyboard: invert a conditionPeter Hutterer
No functional changes, just to make the next patch easier to review Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-04-12udev: builtin-keyboard: move actual key mapping to a helper functionPeter Hutterer
No changes in the mapping, but previously we opened the device only on successful parsing. Now we open the mapping as soon as we have a value that looks interesting. Since errors are supposed to be the exception, not the rule, this is probably fine. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-04-12udev: builtin-keyboard: immediately EVIOCSKEYCODE when we have a pairPeter Hutterer
Rather than building a map and looping through the map, immediately call the ioctl when we have a successfully parsed property. This has a side-effect: before the maximum number of ioctls was limited to the size of the map (1024), now it is unlimited. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-04-12udev: builtin-keyboard: move fetching the device node upPeter Hutterer
No point parsing the properties if we can't get the devnode to apply them later. Plus, this makes future additions easier to slot in. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-04-12udev: input_id: tag accelerometers as ID_INPUT_ACCELEROMETERHans de Goede
input_id already (tries to) tag accelerometers as such, but this only works for absolute accelerometers. Recent kernels mark accelerometers through an input prop. Trust that prop and always tag devices with it with ID_INPUT_ACCELEROMETER. Note that detection by the prop bit works the same as the existing detection and will ensure that no other tags get set on the device. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-04-12udev: input_id: tag pointing sticks as ID_INPUT_POINTINGSTICKAnthony G. Basile
Also referred to as trackpoint, trackstick. These are marked by recent kernels through an input prop. Forward that prop as udev property so userspace can easily determine whether there is a pointing stick present. These devices were previously marked as ID_INPUT_MOUSE, for backwards compatibility we keep that in place, the new property is an addition.y Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-04-12sd-device,udevd: fix spelling /ammend/amend/Tom Gundersen
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-04-12udev: net_id - improve commentsTom Gundersen
The dev_port concept is a bit confusing, expand on the comment a bit. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-04-12udev: net_id - support multi-port enpo* device namesTom Gundersen
I'd argue that having firmware labels for such devices makes no sense, but they exist, so make sure we handle them as best as we can. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-04-12udev: net_id - fix copy-paste errorTom Gundersen
In case pci_slot overflows we were truncating pci_path instead. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-04-04Revert "udev: rules - modernise add_rule a bit"Yann E. MORIN
Initialisers for anonymous unions are unknown to gcc-4.5, which is still quite widely used. See the following build failure, reported by the Buildroot autobuilders: http://autobuild.buildroot.org/results/11e/11ebb926b891862e270b9cb39fd2ed4344b736a8/build-end.log This reverts commit 5cb98078479d93e25099c1cb73fa9c46aa9ccf29. Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Cc: Tom Gundersen <teg@jklm.no>
2015-03-27Remove hardcoded path /run and configure using --with-rootrundir=David Cortarello
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-03-18libudev: private - introduce udev_device_new_from_synthetic_event()Tom Gundersen
This allows set_action(), read_uevent_file() and read_db() to be made internal to libudev. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-03-18Replace ENOTSUP with EOPNOTSUPPAnthony G. Basile
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-03-18udev-ctrl: fix strict aliasing issuesShawn Landden
it is ironic that "The only purpose of this structure is to cast the structure pointer passed in addr in order to avoid compiler warnings. See EXAMPLE below." from bind(2) Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-03-18udev: properly calculate size of remaining dataZbigniew Jędrzejewski-Szmek
The data comes from the kernel, so chances of it being garbled are low, but for correctness' sake, add the check. CID #996458. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-03-18udev: make set_usec_initialized() internal to libudevTom Gundersen
Instead introduce ensure_usec_initialized(), which copies the timestamp if possible otherwise sets it to now(CLOCK_MONOTONIC). Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-03-18udevd: improve handling of failed workerTom Gundersen
The information in the db is stale, so it does not make sense to expose it any longer. Also, don't drop the kernel event, but simply pass it on to userspace without ammending it. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-03-18udevd: don't free event when killing the worker, wait until it has been reapedTom Gundersen
This will allow us to clean up the device when we are notified about the worker being killed. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-03-18libudev: introduce clone_with_db()Tom Gundersen
This allows us to move the db reading from udevd to libudev. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-03-18udevd: event - make db loading lazy in REMOVE event handlingTom Gundersen
We were explicitly eagerly loading the db, then deletenig the backing file and then processing the rules/symlinks. Instead we delete the backnig db file as the last step and let the db loading be lazy as everywhere else. This may save us a bit of work in casese where the db is not needed, but more importantly it hides some implementation details of libudev-device form udevd. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-03-18libudev: introduce udev_device_properties_copy()Tom Gundersen
To copy properties from one device to another. Drop the equivalent functionality from udevd. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-03-18udev: add SYSCTL{} supportKay Sievers
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-03-18libudev: add missing hunksTom Gundersen
This should have been committed with udev_device_add_property - implicitly mark properties for saving to db Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-03-18libudev: udev_device_read_db - drop unused argumentTom Gundersen
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-03-18libudev: udev_device_add_property - implicitly mark properties for saving to dbTom Gundersen
Note: We also ported touch() and touch_file() from upstream. -AGB. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-03-18udev/libudev: event - move {OLD_,}INTERFACE handling from udevd to libudevTom Gundersen
This should be internal to the library as it is only about reflecting the sysfs state in the udev_device. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-03-18udev: simplify event_queue_update() and add debug loggingTom Gundersen
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-03-18udev: use inttypes.h types wherever appropriateLennart Poettering
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-03-18tree-wide: use _packed_ macro instead of raw gcc __attribute__Lennart Poettering
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-03-18udevd: close race in udev settleTom Gundersen
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-03-01shared: introduce cmsg_close_all() callLennart Poettering
The call iterates through cmsg list and closes all fds passed via SCM_RIGHTS. This patch also ensures the call is used wherever appropriate, where we might get spurious fds sent and we should better close them, then leave them lying around. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>