Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

match_property() do not seem to be ANDed #1

Closed
Tefnet opened this issue Jul 28, 2010 · 2 comments
Closed

match_property() do not seem to be ANDed #1

Tefnet opened this issue Jul 28, 2010 · 2 comments
Assignees

Comments

@Tefnet
Copy link

Tefnet commented Jul 28, 2010

Hi,

I have checked out pyudev from git, and it seems to misbehave a bit:

list(udev.Context().list_devices().match_subsystem('block').match_property('ID_TYPE', 'disk'))

[Device(u'/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda'), Device(u'/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1')]

list(udev.Context().list_devices().match_subsystem('block').match_property('ID_TYPE', 'disk').match_property('DEVTYPE', 'disk'))

[Device(u'/sys/devices/pci0000:00/0000:00:1e.0/0000:03:01.0/host3/target3:0:0/3:0:0:0/block/sr0'), Device(u'/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda'), Device(u'/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1'), Device(u'/sys/devices/platform/floppy.0/block/fd0'), Device(u'/sys/devices/virtual/block/loop0'), Device(u'/sys/devices/virtual/block/loop1'), Device(u'/sys/devices/virtual/block/loop2'), Device(u'/sys/devices/virtual/block/loop3'), Device(u'/sys/devices/virtual/block/loop4'), Device(u'/sys/devices/virtual/block/loop5'), Device(u'/sys/devices/virtual/block/loop6'), Device(u'/sys/devices/virtual/block/loop7'), Device(u'/sys/devices/virtual/block/ram0'), Device(u'/sys/devices/virtual/block/ram1'), Device(u'/sys/devices/virtual/block/ram10'), Device(u'/sys/devices/virtual/block/ram11'), Device(u'/sys/devices/virtual/block/ram12'), Device(u'/sys/devices/virtual/block/ram13'), Device(u'/sys/devices/virtual/block/ram14'), Device(u'/sys/devices/virtual/block/ram15'), Device(u'/sys/devices/virtual/block/ram2'), Device(u'/sys/devices/virtual/block/ram3'), Device(u'/sys/devices/virtual/block/ram4'), Device(u'/sys/devices/virtual/block/ram5'), Device(u'/sys/devices/virtual/block/ram6'), Device(u'/sys/devices/virtual/block/ram7'), Device(u'/sys/devices/virtual/block/ram8'), Device(u'/sys/devices/virtual/block/ram9')]

I assume that second call to match_property should tighten the filter, not loosen it?

http://packages.python.org/pyudev/api.html#udev.Enumerator says:

All added filters must match for a device to be included in the device list, when eventually iterating over this object.

My git head is at 408c318.

bye,
Filip Zyzniewski

@swsnr
Copy link
Contributor

swsnr commented Jul 28, 2010

Indeed, the documentation of pyudev is plain wrong at this point. I've missunderstood the libudev documentation here, sorry for the inconvenience. Filters of the same type are OR'd (filters of different types however are still AND'd).

I'll fix the documentation ASAP.

@swsnr
Copy link
Contributor

swsnr commented Jul 28, 2010

Fixed documentation and internal filtering to reflect the libudev behaviour, closed by 513b3e7

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants