1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-05 06:52:22 +03:00
Commit Graph

128 Commits

Author SHA1 Message Date
David Zeuthen
2938220037 Run scsi_id and ata_id on the scsi_device object
In a multi-initiator setup, the HBA may very well export a SCSI device
for a device that another initiator has already logged into. But since
another initiator has already logged in, the kernel will not create a
block device.

Note that this is also the case for some RAID HBAs - for example, the
LSI 1068 series cards will export a SCSI device for a disk that is in
use by the HBAs RAID engine (no block device will be created here).

Running scsi_id and ata_id on the actual SCSI device means that we can
inquire the capabilities of the device. For example, we can check
whether ID_ATA_FEATURE_SET_SMART and ID_ATA_FEATURE_SET_SMART_ENABLED
is set and, if so, periodically poll the SMART status of the
disk. Even when other initiators has claimed the disk and if the disk
is in use by the RAID engine of the HBA.

Note that we run scsi_id and ata_id on /dev/bsg/* nodes - this is safe
to do because the scsi core guarantees that the bsg device has been
created before the actual add uevent for the scsi_device is emitted.

Since the block device is a direct child of the scsi_device we can
avoid running scsi_id and ata_id again by simply importing the
resulting ID_* properties from the parent.

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-10-30 13:04:35 -04:00
Martin Pitt
c112a41a43 fix various syntax errors in rules 2010-09-21 12:14:50 +02:00
Kay Sievers
9de4a43a89 rules: remove firewire rules for deprecated drivers 2010-07-12 11:04:17 +02:00
Stefan Richter
1bbc1a9cb0 rules: add more FireWire IDs: Point Grey IIDC; AV/C + vendor unique
1. IIDC cameras from Point Grey use the vendor OUI as Specifier_ID
instead of the 1394 TA's OUI but are otherwise fully compliant to the
IIDC spec. Their device files should be accessible like those of any
other IIDC cameras.

2. Originally, the Software_Version of devices that implement FCP
(IEC 61883-1 Function Control Protocol) was meant to be a bitmap of all
command sets that an FCP capable unit supports.  Bitmap flags are
defined for AV/C, CAL, EHS, HAVi, and vendor unique command sets.
Software_Version was revised to be a simple identifier instead, and
devices that support several command sets were meant to instantiate one
unit directory for each command set.  Still, some devices with the flags
for AV/C and vendor unique command sets combined were released (but
apparently no devices with any other flag combinations).  These rare but
existing AV/C + vendor unique devices need to be accessible just like
plain AV/C devices.

Side notes:
 - Many AV/C devices make use of the Vendor Dependent AV/C command, but
this is unrelated to vendor unique FCP command sets.
 - Here are all standardized FireWire protocol identifiers that I know
of, listed as Specifier_ID:Software_Version | specifier | protocol.
0x00005e:0x000001 | IANA    | IPv4 over 1394 (RFC 2734)
0x00005e:0x000002 | IANA    | IPv6 over 1394 (RFC 3146)
0x00609e:0x010483 | INCITS  | SBP-2 (or SCSI command sets over SBP-3)
0x00609e:0x0105bb | INCITS  | AV/C over SBP-3
0x00a02d:0x010001 | 1394 TA | AV/C (over FCP)
0x00a02d:0x010002 | 1394 TA | CAL
0x00a02d:0x010004 | 1394 TA | EHS
0x00a02d:0x010008 | 1394 TA | HAVi
0x00a02d:0x014000 | 1394 TA | Vendor Unique
0x00a02d:0x014001 | 1394 TA | Vendor Unique and AV/C (over FCP)
0x00a02d:0x000100 | 1394 TA | IIDC 1.04
0x00a02d:0x000101 | 1394 TA | IIDC 1.20
0x00a02d:0x000102 | 1394 TA | IIDC 1.30
0x00a02d:0x0A6BE2 | 1394 TA | DPP 1.0
0x00a02d:0x4B661F | 1394 TA | IICP 1.0
For now we are only interested in udev rules for AV/C and IIDC.

Reported-by: Damien Douxchamps <ddsf@douxchamps.net> (Point Grey IIDC ID)
Reported-by: Clemens Ladisch <clemens@ladisch.de> (AV/C + vendor unique ID)
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2010-07-12 11:02:49 +02:00
Harald Hoyer
0c73778809 60-persistent-storage-tape.rules: make own by-path symlink for nst tapes 2010-07-08 11:37:48 +02:00
Harald Hoyer
847b4f84c6 60-persistent-storage-tape: s/path_id.sh/path_id/ 2010-07-07 11:00:23 +02:00
Kay Sievers
4766b1058e rules: tape - remove WAIT_FOR instruction and don't export BSG_DEV 2010-07-07 09:54:21 +02:00
Ryan Harper
2d000ed9d8 Add virtio-blk by-id rules based on 'serial' attribute
Using virtio-blk serial attributes add rules to extract drive serial numbers and
generate by-id links for the block device and partitions.

With these rules added, we now see the following symlinks in disk/by-id

% ls -al /dev/disk/by-id | grep vdb
lrwxrwxrwx. 1 root root   9 Jun  1 22:09 virtio-QM00001 -> ../../vda
lrwxrwxrwx. 1 root root  10 Jun  1 22:09 virtio-QM00001-part1 -> ../../vda1

Signed-off-by: Ryan Harper <ryanh@us.ibm.com>
2010-06-29 17:22:58 +02:00
Martin Pitt
2da64971fd Fix usb printer rule for multiple USB interfaces
Commit f61e72d89 failed to match for the case where an USB printer has multiple
interfaces, such as

  ID_USB_INTERFACES=:ffffff:070102:

Thanks to Pablo Mazzini for spotting this!
2010-06-17 13:19:50 +02:00
Kay Sievers
7bf44da99c rules: add -v to modprobe calls to be able see what will be loaded 2010-05-27 18:52:09 +02:00
Kay Sievers
557b005fda rules: mount fuse control filesystem 2010-05-25 15:10:21 +02:00
Kay Sievers
484e1b2d11 rules: optical drives - use ID_CDROM_MEDIA_TRACK_COUNT_DATA
We should not access non-data optical media, ans skip things
like blkid. It will cause errors for some drives.

  https://bugzilla.kernel.org/show_bug.cgi?id=15757
2010-05-25 09:54:14 +02:00
Kay Sievers
761dfddcc0 create static nodes provided by kernel modules to allow module autoloading 2010-05-20 17:09:04 +02:00
Kay Sievers
06ba47d833 rules: call modprobe on all events but "remove" 2010-04-13 12:20:55 +02:00
Kay Sievers
4b06c40935 replace "add|change" with "!remove" 2010-04-12 16:52:41 +02:00
Kay Sievers
421fbc71c7 rules: we do not have static devices which are renamed 2010-04-12 10:50:59 +02:00
Amit Shah
00e43e357e rules: virtio - fix is to check if the 'name' attribute is present
Fix provided by Harald Hoyer.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
2010-03-22 10:59:46 +01:00
Marco d'Itri
6b32e81929 rules: input - create by-path/ links for pci devices 2010-03-16 12:44:43 +01:00
Amit Shah
3c4b1738a9 Fix virtio-ports rule to use $attr instead of $ATTR
Newer udev versions don't understand $ATTR.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Martin Pitt <martin.pitt@ubuntu.com>
2010-03-04 00:39:53 +01:00
Amit Shah
7b79a59b28 rules: Add symlink rule for virtio ports
virtio ports spawned by the virtio_console.c driver can have 'names'
assigned to them by hosts. The ports are distinguishable using these
names. Make a rule to create a symlink to the chardev associated for a
port with a name.

The symlink created is:
    /dev/virtio-ports/org.libvirt.console0 -> /dev/vport0p0

if the first port for the first device was given a name of
'org.libvirt.console0'.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
2010-01-21 14:21:42 +01:00
Kay Sievers
caf87866a7 rules: add "block" match to floppy rule 2009-12-15 16:17:12 +01:00
Kay Sievers
78171d9549 floppy: fix rule to create additional floppy device nodes 2009-12-15 15:07:25 +01:00
David Zeuthen
7f4954d040 Export ID_WWN_VENDOR_EXTENSION and ID_WWN_WITH_EXTENSION
Some SCSI devices use the same WWN and have a WWN extension that we
need to take into account when creating the /dev/disk/by-id/wwn
symlinks. Thus, introduce ID_WWN_WITH_EXTENSION. This property will
contain either the WWN (if no extension is present) or the WWN with
the vendor extension appended.

Example:

 # /lib/udev/ata_id/ata_id --export /dev/sda |grep WWN
 ID_WWN=0x5001517387d61905
 ID_WWN_WITH_EXTENSION=0x5001517387d61905

 # /lib/udev/scsi_id --whitelisted --export -d /dev/sdb |grep WWN
 ID_WWN=0x600508b400105df7
 ID_WWN_VENDOR_EXTENSION=0x0000e00000d80000
 ID_WWN_WITH_EXTENSION=0x600508b400105df70000e00000d80000

 # /lib/udev/scsi_id --whitelisted --export -d /dev/sdc |grep WWN
 ID_WWN=0x600508b400105df7
 ID_WWN_VENDOR_EXTENSION=0x0000e00000db0000
 ID_WWN_WITH_EXTENSION=0x600508b400105df70000e00000db0000

Signed-off-by: David Zeuthen <davidz@redhat.com>
2009-12-04 11:40:00 -05:00
Martin Pitt
6722e19ab1 input: Deprecate ENV{ID_CLASS}
The ID_CLASS property on input devices has been replaced by the more accurate
set of flags ID_INPUT_{KEYBOARD,KEYS,MOUSE,TOUCHPAD,TABLET,JOYSTICK}.

Rewrite 60-persistent-input.rules to use the new properties now and not export
ID_CLASS any more, since it is not used by anything else any more.

Add note about migration to NEWS, in case this is being used in custom rules.
2009-11-30 19:16:09 +01:00
Martin Pitt
a6cf773401 extras: Add input_id
input_id probes input/event devices for their class (keyboard, keys, mouse,
touchpad, tablet, joystick). This is based on the corresponding hal code in
hald/linux/device.c, input_test_{abs,rel,...}.

This should provide enough functionality to get hal-less X.org working (which
in particular needs to know exactly which devices are touchpads).

Replace the brittle hacks in 60-persistent-input.rules with checking for the
new ID_INPUT_* flags. This keeps the old ID_CLASS properties for now (but they
are to be removed later on).

Note: The current code has several hacks still, which are to be replaced with
proper libudev calls later on.
2009-11-30 18:38:43 +01:00
David Zeuthen
d6b5571c12 Also create /dev/disk/by-id/wwn-0x..-part%n symlinks for partitions
# ls -l /dev/disk/by-id/wwn-0x500
 wwn-0x500000e01b83f360        wwn-0x50014ee25578924f-part1
 wwn-0x500000e01b83f440        wwn-0x50014ee25578924f-part2
 wwn-0x500000e01b83f520        wwn-0x50014ee2aabdc41b
 wwn-0x500000e01b843d90        wwn-0x50014ee2aabdc41b-part1
 wwn-0x5000c50016359fd1        wwn-0x50014ee2aabdc41b-part2
 wwn-0x50014ee0016eb4f5        wwn-0x5001517958cabd77
 wwn-0x50014ee0016eb572        wwn-0x5001517958cabd77-part1
 wwn-0x50014ee055d524e2        wwn-0x5001517958cabd77-part2
 wwn-0x50014ee055d524e2-part1  wwn-0x5001517958d6a74e
 wwn-0x50014ee055d524e2-part2  wwn-0x5001517958d6a74e-part1
 wwn-0x50014ee1003d9c50        wwn-0x5001517958d6a74e-part2
 wwn-0x50014ee1003d9c50-part1  wwn-0x50024e9200c0c693
 wwn-0x50014ee1003d9c50-part2  wwn-0x50024e9200c0c694
 wwn-0x50014ee1aac30d4e        wwn-0x50024e9200c0c6ae
 wwn-0x50014ee1aac30d4e-part1  wwn-0x50024e9200c0c6af
 wwn-0x50014ee1aac30d4e-part2  wwn-0x50024e9200c0c6b0
 wwn-0x50014ee25578924f        wwn-0x50024e9200c0c6b1

Signed-off-by: David Zeuthen <davidz@redhat.com>
2009-11-25 11:17:54 -05:00
David Zeuthen
28c7463999 Create /dev/disk/by-id/wwn-0x... symlinks
Now that both ata_id and scsi_id exports the World Wide Name in the
ID_WWN property, use this to create persistent symlinks. Example

 /dev/disk/by-id/wwn-0x500000e01b83f360 -> ../../sdn
 /dev/disk/by-id/wwn-0x500000e01b83f440 -> ../../sdm

Signed-off-by: David Zeuthen <davidz@redhat.com>
2009-11-25 11:10:47 -05:00
Kay Sievers
ecf61aa7fd rules: remove support for IDE (hd*) devices
The kernel IDE drivers get deprecated now:
  http://article.gmane.org/gmane.linux.ide/43151

Almost everybody has switched over to libata devices long ago.
Recent services do not work with the now deprecated IDE drivers
at all and require libata drivers and SCSI infrastructure.

Systems who care about the old stuff need to add the rules to the
compat rules.
2009-11-19 16:25:18 +01:00
Kay Sievers
d93fb59c50 rules: set mode of floppy device nodes to 0660 2009-11-12 21:56:27 +01:00
Lennart Poettering
088fbefafd Revert "sound: include ALSA sound card id in /dev/snd/by-id/ links"
This reverts commit 68bffc607f.

After discussing this with Kay we decided to drop this again as by-id
links only make sense for devices that have a unique serial id. If they
don't any attempts to make them unique have the side effect of
nourishing assumptions by users that cannot be met, as the by-id device
link of a device could differ depending on the history of simultaneously
plugged in device.

So, to make sure that all device nodes follow the same rules for by-id/
symlinks, drop this patch again.
2009-11-09 23:19:04 +01:00
Lennart Poettering
68bffc607f sound: include ALSA sound card id in /dev/snd/by-id/ links
If two USB sound cards that have the same serial number are plugged in
make sure the by-id/ device node symlink is unique at least during
runtime, by including the ALSA card id in the symlink name.

This is a followup to ed1b2d9fc7.
2009-11-09 22:11:29 +01:00
Lennart Poettering
ed1b2d9fc7 sound: include ALSA sound card id in ID_ID property
If two USB sound cards that have the same serial number are plugged in
make sure ID_ID is unique at least during runtime, by including the ALSA
card id in the ID_ID string.

Fixes issues like this one:
http://pulseaudio.org/ticket/661
2009-11-05 04:32:41 +01:00
Martin Pitt
ca2bf8007d 50-udev-default.rules: fix printer MODE
Prefix with a 0 to be consistent with other rules.

https://launchpad.net/bugs/438114
2009-10-05 11:38:44 +02:00
Martin Pitt
8d12968558 make raw USB printer devices world-readable again
Commit f61e72d8 made raw USB printers accessible for the lp group. However,
chmoding them to 0660 is a bit over-zealous, since by default raw USB devices
are world-readable. Not being so breaks lsusb unnecessarily. Now set
permissions to 0664.
2009-09-30 11:10:24 +02:00
Martin Pitt
6e1a152d1c fix previous commit for CD detection
Do not run blkid twice. *brown paperbag*
2009-09-20 19:21:04 +02:00
Martin Pitt
ce096702ec fix single-session CD detection
ID_CDROM_MEDIA_SESSION_LAST_OFFSET is not set for CDs with only a single
session (i. e. for the vast majority of CDs out there). The previous rules ran
blkid with invalid arguments for these, causing CD detection to fail in
DK-disks and gvfs.

Now check whether we actually have ID_CDROM_MEDIA_SESSION_LAST_OFFSET, and if
not, call blkid without -O for specifying the offset.

Many thanks to Maxim Levitsky for tracking this down!

https://launchpad.net/bugs/431055
2009-09-20 19:07:51 +02:00
Kay Sievers
4b4409b1ee rules: drop almost all NAME= keys
The drivers in kernel 2.6.31 supply the names for custom node names if
needed.
2009-09-16 20:08:50 +02:00
Lennart Poettering
c26e3f6901 sound: recognize saa7134 TV card sound devices as TV cards 2009-09-09 23:12:25 +02:00
Kay Sievers
6c29f2b942 simplify "symlink name stack"
With well defined and kernel-supplied node names, we no longer need
to support a possible stack of conflicting symlinks and node names.
Only symlinks with identical names can be claimed by multiple devices.

This shrinks the former /dev/.udev/names/ significantly.

Also the /dev/{block,char}/MAJ:MIN" links are excluded from the name
stack - they are unique and can not conflict.
2009-09-09 18:49:07 +02:00
Martin Pitt
f61e72d897 make raw USB printer devices accessible for lp
Starting from version 1.4, cups now uses libusb and printer USB devices instead
of the usblp generated /dev/usb/lpX ones. In order to not require the cups USB
backend to run as root now, change raw USB printer devices to be root:lp 0660,
similar to usblpX devices.

This might also enable the hplip backend to not run as root, since this has
always used raw device nodes.

https://launchpad.net/bugs/420015
2009-09-04 17:12:28 +02:00
Marco d'Itri
069eab7c96 rules: sound - do not use /usr/bin/env
The C version of path_id does not look at the environment anymore, so
there is no reason to empty it.
2009-09-01 12:05:47 +02:00
Kay Sievers
79f3b4a161 rules: rfkill has no group, so use 0644
Thanks to Marco d'Itri<md@linux.it> for noticing.
2009-08-16 21:07:39 +02:00
Alan Jenkins
214a6c791c fix spelling
Fix spelling in docbook comments, code comments, and a local variable
name.  Thanks to "ispell -h" for docbook HTML and "scspell" for source
code.

Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
2009-08-08 15:42:05 +02:00
Kay Sievers
f7c5b04f69 re-enable failed event tracking
It did not work for the last couple of releases.

If RUN{record_failed}+="..." is given, a non-zero execution will mark
the event as failed. Recorded failed events can be re-triggered with:
  udevadm trigger --type=failed

The failed tracking _might_ be useful for things which might not be
ready to be executed at early bootup, but a bit later when the needed
dependencies are available. In many cases though, it indicates that
something is used in a way it should not.
2009-08-06 16:16:26 +02:00
Anssi Hannula
d256454415 rules: exclude digitizers from joystick class
Exclude digitizers and similar devices from ID_CLASS joystick by
checking modalias for BTN_DIGI.

This was also done for linux kernel joydev interface in linux commit
d07a9cba6be5c0e947afc1014b5a62182a86f1f1.
2009-08-05 05:07:15 +02:00
Kay Sievers
8f2f1b1262 rules: serial - fix path_id call 2009-07-23 20:30:52 +02:00
Stefan Richter
f0fb82d821 rules: set group ownership of new firewire driver device files
The newer firewire-core driver exposes per-device character device files,
called /dev/fw[0-9]*, in contrast to the older raw1394, video1394, dv1394
drivers which created one global file or per-controller files.

This allows to set ownership, permissions, or/ and access control lists
for each device file based on device type markers obtained from sysfs.
The "units" attribute which is used for this purpose has become available
in Linux 2.6.31(-rc1) by commit 0210b66dd88a2a1e451901b00378a2068b6ccb35.

The added rules match identifiers of

  - IIDC devices:
    industrial cameras and some webcams,

  - AV/C devices:
    camcorders, set-top boxes, TV sets, audio devices, and similar
    devices.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2009-07-01 23:43:17 +02:00
Kay Sievers
8bbe3ca427 rules: make ata_id properties the default for all ATA block devices
We need to call ata_id as the default for libata sd* devices. We
want ID_BUS=ata, and the ATA device proeprties, and be independent
of the SCSI emulation with the truncated values. The links
in /dev/disk/by-id/{ata-*,scsi-*} are still the same.
2009-06-28 02:59:48 +02:00
Kay Sievers
fed0ad7694 ata_id: sync ID_SERIAL(_SHORT) with other *_id tools
ID_SERIAL is the full serial number used for the links, ID_SERIAL_SHORT
is the device serial number.
2009-06-28 02:58:12 +02:00
Kay Sievers
a8aab0e95b rules: remove MMC rule, 2.6.30 has the modalias 2009-06-17 02:33:49 +02:00