| Summary: | Solid query fails to match PortableMediaPlayer with specified property | ||
|---|---|---|---|
| Product: | [Frameworks and Libraries] frameworks-solid | Reporter: | Rajeesh K V <rajeeshknambiar> |
| Component: | general | Assignee: | Lukáš Tinkl <lukas> |
| Status: | REPORTED --- | ||
| Severity: | normal | CC: | jgrulich, kdelibs-bugs-null, rajeeshknambiar |
| Priority: | NOR | ||
| Version First Reported In: | 5.1.0 | ||
| Target Milestone: | --- | ||
| Platform: | Fedora RPMs | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
| Attachments: | Debugger screenshot | ||
Created attachment 91560 [details]
Debugger screenshot
My mistake. The query had a typo (uppercase 'S' in 'SupportedProtocols'). Correcting this makes QMetaObject::indexofProperty() retun correct index. Yet ultimately the predicate matching fails. $solid-hardware5 query "PortableMediaPlayer.supportedProtocols & 'ipod'" returns nothing. Debugging further showed the following: In bool Solid::Predicate::matches(const Device &device) const d->type is "PropertyCheck" and d->compOperator is "Mask", in which case the metaProp value and expected value are converted to int and this fails. Are string properties not supported for Mask operator? It looks it doesn't work that way and the syntax is also different, you can only use something like "solid-hardware5 query 'IS PortableMediaPlayer' and that's all. Thank you for the bug report. As this report hasn't seen any changes in 5 years or more, we ask if you can please confirm that the issue still persists. If this bug is no longer persisting or relevant please change the status to resolved. $ solid-hardware5 details '/org/kde/solid/udev/sys/devices/pci0000:00/0000:00:14.0/usb1/1-1'
udi = '/org/kde/solid/udev/sys/devices/pci0000:00/0000:00:14.0/usb1/1-1'
parent = '/org/kde/solid/udev' (string)
vendor = 'Apple Inc.' (string)
product = 'iPhone' (string)
description = 'Camera' (string)
icon = 'camera-photo' (string)
Block.major = 189 (0xbd) (int)
Block.minor = 5 (0x5) (int)
Block.device = '/dev/bus/usb/001/006' (string)
Camera.supportedProtocols = {'ptp'} (string list)
Camera.supportedDrivers = {'gphoto'} (string list)
It appears 'ipod' is no longer even in the supported protocols list.
|
Using kf5-solid-5.7.0-3.fc21.x86_64. $ solid-hardware5 details /org/kde/solid/udev/sys/devices/pci0000:00/0000:00:14.0/usb1/1-1 udi = '/org/kde/solid/udev/sys/devices/pci0000:00/0000:00:14.0/usb1/1-1' parent = '/org/kde/solid/udev' (string) vendor = 'Apple Inc.' (string) product = 'iPhone' (string) description = 'Portable Media Player' (string) Block.major = 189 (0xbd) (int) Block.minor = 1 (0x1) (int) Block.device = '/dev/bus/usb/001/002' (string) Camera.supportedProtocols = {'ptp'} (string list) Camera.supportedDrivers = {'gphoto'} (string list) PortableMediaPlayer.supportedProtocols = {'storage', 'ipod'} (string list) PortableMediaPlayer.supportedDrivers = {'usb', 'usbmux'} (string list) $solid-hardware5 query "SupportedProtocols & 'ipod'" (returns nothing) Reproducible: Always Steps to Reproduce: 1. Plug in a portable media player (I have an iPhone which is listed as PortableMediaPlayer device by Solid) 2. Run solid-hardware5 query "SupportedProtocols & 'ipod'" 3. Observe that solid-hardware5 query does not list the object Actual Results: Solid query fails to list the device Expected Results: Device udi is returned I have debugged, and tracked down the issue to: method Solid::Predicate::matches(const Device &device) specifically const int index = iface->metaObject()->indexOfProperty(d->property.toLatin1()); fails to return the property index. iface->metaObject() has two properties {SupportedDrivers,SupportedProtocols}. But indexOfProperty("SupportedProtocols") returns index -1. See attached debugger screenshot. Please let me know if I can provide any additional information or do further debugging.