[systemd-devel] udevd detect and list ata devices

Steve Abner pheonix.sja at att.net
Sun Dec 6 13:03:18 PST 2015



On 12/06/2015 11:46 AM, Marek wrote:
> thanks Robert, eample2 does list all disks but doens't differentiate
> between ata and usb.
>
> On Sun, Dec 6, 2015 at 10:49 AM, Robert Milasan <rmilasan at suse.com> wrote:
>> On Sun, 6 Dec 2015 01:49:41 +0100
>> "Marek" <mlf.conv at gmail.com> wrote:
>>> udev_device_get_sysname(block)
>>> /sys/devices/pci0000:00/0000:00:11.0/ata1/host0/target0:0:0/0:0:0:0/block/sda
>>> /sys/devices/pci0000:00/0000:00:12.2/usb1/1-1/1-1:1.0/host8/target8:0:0/8:0:0:0/block/sdg
>> Try this examples: https://github.com/robertalks/udev-examples.git
>>
>> Might help with what you are trying or give you an idea.
>>
Hi, just learning, but doesn't strncmp() of the 5th subdirectory solve 
whether its ata or
usb, using example2 DEVPATH. My system looks like I could list 
/sys/block, parse for "sd"
then for ata or usb. If you go by /sys/devices, I believe you can get 
fw, hwmon, net, audio.
Even with example2, you screen out "sd" vs "sr".
Don't shout me, just trying to understand.
Steve


More information about the systemd-devel mailing list