Thunderbolt KCM and KDED module
AbandonedPublic

Authored by dvratil on Feb 14 2019, 4:47 PM.

Details

Reviewers
None
Group Reviewers
VDG
Plasma
Maniphest Tasks
T9012: Thunderbolt 3 Security Plasma Integration
Summary

The KCM allows user to authorize and trust (or revoke trust) Thunderbolt 3 devices.
This is done by communicating with the Bolt daemon via DBus (through libkbolt).

The KDED module listens for new unauthorized devices and shows a
notification with a button to authorize when such device is connected.

Obligatory screenshots:


See https://mail.kde.org/pipermail/plasma-devel/2019-February/093482.html for details and a link to a video.

Test Plan

Tested with my Dell laptop and Dell dock station, I unfortunately don't have access to any other Thunderbolt hardware.

Diff Detail

Repository
R119 Plasma Desktop
Branch
arcpatch-D19011
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 11325
Build 11343: arc lint + arc unit
There are a very large number of changes, so older changes are hidden. Show Older Changes
yurchor added inline comments.Feb 14 2019, 7:41 PM
kcms/bolt/package/contents/ui/DeviceView.qml
142

Typo: successfuly -> successfully

kded/bolt/kded_bolt.notifyrc
24

Typo: occured -> occurred

ognarb added a subscriber: ognarb.Feb 14 2019, 11:25 PM
ognarb added inline comments.
autotests/bolt/fakeserver/fakeserver.h
2

You forgot to add a GPL license header for this file. Same for:

  • autotests/bolt/fakeserver/fakeserver.cpp
  • autotests/bolt/kded/kdedtest.cpp
  • autotests/bolt/lib/managertest.cpp
  • autotests/bolt/lib/devicetest.cpp
  • kcms/bolt/package/contents/ui/DeviceList.qml
  • kcms/bolt/package/contents/ui/utils.js
broulik added inline comments.
kcms/bolt/package/contents/ui/DeviceList.qml
12

You might want to be using a ScrollViewKCM and put the enable checkbox in the header and the ListView in view, see for instance KWin's virtual desktop KCM

30

Use onToggled which is only fired when the user explicitly clicks it rather than if some binding causes it to change.
Then you could also bind the checked: deviceModel.manager.authMode ... directly (it shouldn't break the binding when you click it as in QQC2 that stuff is all done in C++)

Also, no need for function()

kcms/bolt/package/contents/ui/main.qml
89

onItemClicked?

kded/bolt/kded_bolt.cpp
91

Now we need a beautiful Breeze Thunderbolt icon :)

117

reserve()?

147

Please HTML escape the device name

libs/bolt/device.h
46

Does bolt not notify property changes on dbus? Not a huge fan of this Timer refresh hack

dvratil updated this revision to Diff 51737.Feb 15 2019, 10:20 AM
dvratil marked 9 inline comments as done.
  • Fixed typos
  • Unified license
  • Addresses comments from kbroulik
dvratil added inline comments.Feb 15 2019, 10:21 AM
kcms/bolt/package/contents/ui/DeviceList.qml
12

Hmm, but then I couldn't push the device view page on the stack, because there would be no PageRow, right?

libs/bolt/device.h
46

Unfortunately not, the DBus interface is a bit weird and the implementation even weirder.

I believe the list of devices should be in a white box. There should also be a couple of controls at the bottom right of the box containing the devices. @ngraham Is that right? @fabianr ?

I believe the list of devices should be in a white box. There should also be a couple of controls at the bottom right of the box containing the devices. @ngraham Is that right? @fabianr ?

That's right, the list needs a frame and a white background, rather than just having the items floating there in the middle of the page. The new Virtual Desktops KCM is a good visual template.

Thanks for the feedback, I'll look into it asap. In the meantime, could I ask the VDG to create a Breeze icon for Thunderbolt? @abetts, maybe?

Thanks for the feedback, I'll look into it asap. In the meantime, could I ask the VDG to create a Breeze icon for Thunderbolt? @abetts, maybe?

or @andreask or @trickyricky26 or @ndavis. We have a lot of icon design talent here these days. :)

dvratil updated this revision to Diff 52255.Feb 21 2019, 10:58 PM
  • fix look of the device list
dvratil edited the summary of this revision. (Show Details)Feb 21 2019, 10:59 PM

Thanks, much better! Just a few more UI nitpicks. And one more thing: What does "Stored" mean in this context? As a non-Thunderbolt expert, I don't know what this means, and I suspect most users wouln't, either.

kcms/bolt/package/contents/ui/DeviceList.qml
42

"Enable" might be a better word than "Allow" in this string.

kcms/bolt/package/contents/ui/DeviceView.qml
51

Can we give this a label or make it a Button instead? Many users have difficulty recognizing label-less toolbuttons floating inside the page as clickable buttons.

151

I'd recommend that we center this horizontally on the page.

dvratil added a comment.EditedFeb 22 2019, 6:21 PM

"Stored" is a term for a remembered device. When you authorize a device, the authorization is "stored", or remembered, so you don't have to authorize it again next time. Maybe "Remember" would be a better term, then? Also works better with the "Forget".

"Stored" is a term for a remembered device. When you authorize a device, the authorization is "stored", or remembered, so you don't have to authorize it again next time. Maybe "Remember" would be a better term, then? Also works better with the "Forget".

What is a "remembered device"? As in, the settings for this particular device are remembered and re-applied when the device is unplugged and plugged in again later?

How about "Trusted" for remembered devices that are authorized, and "Prohibited" for remembered devices that are not authorized?

"Remembered" would work only if it's clear what's being remembered (i.e. the settings). Maybe it could say "Settings remembered" or something?

How about "Trusted" for remembered devices that are authorized, and "Prohibited" for remembered devices that are not authorized?

"Remembered" would work only if it's clear what's being remembered (i.e. the settings). Maybe it could say "Settings remembered" or something?

“Trusted” and “Untrusted” devices sounds better, considering the nature of thunderbolt devices enabled explicitly by user.

dvratil updated this revision to Diff 52568.Feb 25 2019, 10:35 PM
  • Wording: replaced Stored with Trusted
  • Layout: centered all controls on device view page
dvratil edited the summary of this revision. (Show Details)Feb 25 2019, 10:36 PM
ngraham added inline comments.Feb 25 2019, 11:11 PM
kcms/bolt/package/contents/ui/DeviceView.qml
134

"Trust this Device"?

155

"Revoke Trust"?

dvratil updated this revision to Diff 52593.Feb 26 2019, 10:26 AM
  • Wording: improved trust button labels, thanks for suggestions, Nate.

Can the text to the right of the list, "Trusted" be a different color and maybe a smaller font? When using the same font, color and size as the device name, it seems that they are the same thing. One is device name and the other is device status. I am just wondering if we could differentiate them visually.

Can the text to the right of the list, "Trusted" be a different color and maybe a smaller font? When using the same font, color and size as the device name, it seems that they are the same thing. One is device name and the other is device status. I am just wondering if we could differentiate them visually.

Hey, that's not a bad idea. The font should probably be the same size, but we could use the color scheme's positive color for trusted and its neutral or negative color for untrusted.

dvratil updated this revision to Diff 52775.Feb 27 2019, 9:57 PM
  • Use colors in device status indicators
dvratil edited the summary of this revision. (Show Details)Feb 27 2019, 9:57 PM

Didn't like my latest string suggestions?

Trust this Device / Revoke Trust

dvratil updated this revision to Diff 53323.Mar 6 2019, 10:12 PM
  • Wording: Trust this Device/Revoke Trust button labels
dvratil edited the summary of this revision. (Show Details)Mar 6 2019, 10:15 PM
ngraham accepted this revision as: VDG.Mar 6 2019, 10:16 PM

UI looks good to me now! Nice job.

dvratil edited the summary of this revision. (Show Details)Mar 6 2019, 10:16 PM

Ping, VDG folks are OK with this, how about Plasma :)?

What should happen when the "Help" button at the bottom of KCM page is pressed?

Thanks in advance for your answer.

dvratil updated this revision to Diff 54625.Mar 23 2019, 3:51 PM

Remove 'Help', 'Default' and 'Apply' buttons as they serve no purpose here,
there's no help at the moment, there's no default state to revert to and the
changes to devices are applied immediately.

GB_2 added a subscriber: GB_2.Apr 15 2019, 7:37 AM

Looks ok to me.

I realized we still need an icon for Thunderbolt (and thus for this KCM) - @abetts, @andreask, @trickyricky26, @ndavis - could one of you help me out, please? I have no clue about icons...

zzag added a subscriber: zzag.Apr 15 2019, 8:44 AM
zzag added inline comments.
kded/bolt/kded_bolt.h
35

Coding style nitpick:

Function implementations, class, struct and namespace declarations always have the opening brace on the start of a line.

libs/bolt/dbushelper.cpp
36

Nitpick: "// anonymous namespace" is more verbose. :-)

libs/bolt/device.cpp
96

Coding style nitpick(?): Maybe it's a matter of taste, but is it a good idea to use auto here?

I realized we still need an icon for Thunderbolt (and thus for this KCM) - @abetts, @andreask, @trickyricky26, @ndavis - could one of you help me out, please? I have no clue about icons...

Please file a bug to Breeze | Icons and request the icon! :)

It might be not very stylish but just to make the whole thing work...

Submit it in a patch to breeze-icons! :)

New icon just landed in D20672. The name is preferences-desktop-thunderbolt.

dvratil updated this revision to Diff 57147.Apr 28 2019, 9:13 PM
  • Update the icon
  • Rebase on current master

I say let's get this in for 5.16.

I was wondering, since this thing has like a lib and kded and what not, wouldn't it make sense to have that be a separate module and repository rather than in plasma-desktop "just because" all kcms are in there?

For the lack of Thunderbolt devices I have only tried the checkbox for turning it on and off :) Is there a way to fix it asking for a password right when opening it? No other KCM does that.

@broulik I asked on plasma-devel where to put this and got no definitive answer, so I put it here. Separate repo is fine with me, too. What name for the repo would you prefer? plasma-thunderbolt? I already have kcm_bolt scratch repo, so I can just "backport" the changes from here into it and ask sysadmins to move it to kde/workspace and rename it.

The password prompt, I believe, is from polkit - I did not see it on my system. Maybe the polkit rules in boltd are wrong, but I believe we only do read-only operations when you open the KCM.

plasma-thunderbolt sounds fine to me FWIW.

Plasma 5.16 has been released and master is wide open for new features. Can we get this landed in some capacity soon? It would be great to have more testing time.

pino added a subscriber: pino.Jun 16 2019, 7:05 PM

Plasma 5.16 has been released and master is wide open for new features. Can we get this landed in some capacity soon? It would be great to have more testing time.

There is already a plasma-thunderbolt repository with this code. IMHO it fits better than adding everything to plasma-desktop, and it can be already tested without requiring the git/master version of plasma-desktop.

Ah OK, I hadn't realized it got moved there yet. I guess this revision can be abandoned then, and we should lobby distros to ship with the new repo/package.

dvratil abandoned this revision.Jun 17 2019, 12:17 PM

The code has been moved to a standalone plasma-thunderbolt repository, passed through kde-review and will be included in Plasmas 5.17 release.

Thanks everyone for your feedback and comments!

and we should lobby distros to ship with the new repo/package.

Provide a tarball and I'll gladly turn our git master ebuild into a release ebuild. ;)

I guess you'll have to wait for 5.17 for that, unless @jriddell wants to oblige. :)