[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: Re: Bug in getting device interfaces with Solid ?
From: "Christopher Blauvelt" <cblauvelt () gmail ! com>
Date: 2008-07-09 18:58:16
Message-ID: ffa898c90807091158g2e5aa88aif006a7d6649109fb () mail ! gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
On Wed, Jul 9, 2008 at 1:27 PM, David Boosalis <david.boosalis@gmail.com>
wrote:
> When I start my KDE application, I would like to know if a USB stick is
> already mounted. I have implemented the following code as an example:
>
> Solid::Device device;
> KCmdLineArgs* args = KCmdLineArgs::parsedArgs();
> QList< Solid::Device > storageDevices =
> Solid::Device::listFromType(Solid::DeviceInterface::StorageDrive);
>
> kDebug() << "Storeage List Count = " << storageDevices.count();
> QListIterator <Solid::Device > iter(storageDevices);
> Solid::DeviceInterface *di;
> Solid::StorageDrive *storageDrive;
> while(iter.hasNext()) {
> device = iter.next();
> di = device.asDeviceInterface(Solid::DeviceInterface::StorageDrive);
> storageDrive = (Solid::StorageDrive *) di;
> if (storageDrive) {
> kDebug() << "is storage drive, type = " << storageDrive->driveType();
> kDebug() << "bus type = " << storageDrive->bus();
> if (storageDrive->driveType() == Solid::StorageDrive::MemoryStick) {
> kDebug() << "Hey we have a memory stick....";
> break;
> }
> }
> }
>
>
> On my laptop without a memory stick plugged in I get the following:
>
> .Storeage List Count = 2
> .is storage drive, type = 1
> bus type = 3
> is storage drive, type = 0
> bus type = 3
>
>
> I think these refer to the Linux partion of my hard drive as well as the
> ntfs windows partion.
>
> Now when I plug in a usb card and then run. It show three drives as shown
> in the following output:
>
> Storeage List Count = 3
> s storage drive, type = 0
> bus type = 1
> is storage drive, type = 1
> bus type = 3
> is storage drive, type = 0
> bus type = 3
>
> Why doesn't the usb stick have a type of Solid::StorageDrive::MemoryStick
> and why is not the bustype reported as a USB bus. Is my thinking wrong
> here, if so what do you recommen in order to determine if a usb memory stick
> is already inserted when my application starts up.
>
> By the way I am running Kubuntu with KDE Trunk (last updated July 8)
>
> Thank yo uin advance for any help
>
>
>
>
>
>
> >> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to
> unsubscribe <<
>
>
The first thing to do would be to plug-in the device and query it using
SolidShell. If that's not giving you the data that you expect then it's
likely an issue with Hal. Use hal-info to query the device, if it's not
what you expect then you'll need to file a bug with Hal. If hal is
reporting the right information but no Solid, just let us know.
Chris
[Attachment #5 (text/html)]
<br><br>
<div class="gmail_quote">On Wed, Jul 9, 2008 at 1:27 PM, David Boosalis <<a \
href="mailto:david.boosalis@gmail.com">david.boosalis@gmail.com</a>> wrote:<br> \
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; \
BORDER-LEFT: #ccc 1px solid">When I start my KDE application, I would like to know if \
a USB stick is already mounted. I have implemented the following code as an \
example:<br> <br> Solid::Device device;<br> KCmdLineArgs* args = \
KCmdLineArgs::parsedArgs();<br> QList< Solid::Device > storageDevices \
=<br> \
Solid::Device::listFromType(Solid::DeviceInterface::StorageDrive);<br><br> \
kDebug() << "Storeage List Count = " << \
storageDevices.count();<br> QListIterator <Solid::Device > \
iter(storageDevices);<br> Solid::DeviceInterface *di;<br> \
Solid::StorageDrive *storageDrive;<br> while(iter.hasNext()) \
{<br> device = iter.next();<br> di = \
device.asDeviceInterface(Solid::DeviceInterface::StorageDrive);<br> \
storageDrive = (Solid::StorageDrive *) di;<br> \
if (storageDrive) {<br> kDebug() << "is \
storage drive, type = " << \
storageDrive->driveType();<br> kDebug() << \
"bus type = " << storageDrive->bus();<br> \
if (storageDrive->driveType() == \
Solid::StorageDrive::MemoryStick) {<br> kDebug() << "Hey \
we have a memory stick....";<br> \
break;<br> }<br> }<br> \
}<br><br><br>On my laptop without a memory stick plugged in I get the following:<br> \
<br>.Storeage List Count = 2<br>.is storage drive, type = 1<br>bus type \
= 3<br>is storage drive, type = 0<br> bus type = \
3<br><br><br>I think these refer to the Linux partion of my hard drive as well as the \
ntfs windows partion.<br> <br>Now when I plug in a usb card and then run. It show \
three drives as shown in the following output:<br><br>Storeage List Count = \
3<br>s storage drive, type = 0<br>bus type = 1<br>is storage drive, type \
= 1<br>bus type = 3<br> is storage drive, type = 0<br>bus type \
= 3<br><br>Why doesn't the usb stick have a type of \
Solid::StorageDrive::MemoryStick and why is not the bustype reported as a USB \
bus. Is my thinking wrong here, if so what do you recommen in order to \
determine if a usb memory stick is already inserted when my application starts \
up.<br> <br>By the way I am running Kubuntu with KDE Trunk (last updated July \
8)<br><br>Thank yo uin advance for any help<br><br><br><br><br><br><br>>> Visit \
<a href="http://mail.kde.org/mailman/listinfo/kde-devel#unsub" \
target="_blank">http://mail.kde.org/mailman/listinfo/kde-devel#unsub</a> to \
unsubscribe <<<br> <br></blockquote></div>
<div> </div>
<div>The first thing to do would be to plug-in the device and query it using \
SolidShell. If that's not giving you the data that you expect then it's \
likely an issue with Hal. Use hal-info to query the device, if it's not \
what you expect then you'll need to file a bug with Hal. If hal is \
reporting the right information but no Solid, just let us know.</div>
<div>Chris<br></div>
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic