Implement uart permission check in a more distro independent way#20
Implement uart permission check in a more distro independent way#20bebu wants to merge 1 commit intoTeamOpenFIRE:OpenFIRE-devfrom
Conversation
…rease compatability between qt versions 5 and 6
|
Looks functionally good, just have a couple of concerns if you could check those out. 🙂 |
|
Sure! But I can't seem to find any comments? |
|
Actually not, its also not marked as being reviewed. |
SeongGino
left a comment
There was a problem hiding this comment.
Just got back from a short break, and I forgot to actually send these as requested changes, apologies!
| if(!usbName.length()) { | ||
| PopupWindow("No OpenFIRE devices detected!", "Is the microcontroller board currently running OpenFIRE and is currently plugged in? Make sure it's connected and recognized by the PC.\n\nThis app will now close.", "ERROR", 4); | ||
| exit(1); | ||
| }else{ |
There was a problem hiding this comment.
Weird to have an unresolved if branch that isn't inside the Unix conditional block? This should be bumped down to be part of if(getuid()) (and the closing brace should be outside of it too). Also consistent spacing.
| }else{ | ||
| #if !defined(Q_OS_MAC) && !defined(Q_OS_WIN) | ||
| if(getuid()) { | ||
| auto deviceName = usbName.first(); |
There was a problem hiding this comment.
Question: does this actually work if we do not have any compatible devices plugged in? I was under the assumption that users outside of dialout don't get any devices (and we've already pruned out any system ttySX virt terminals at this point).
It would be ideal to inform the user first that they should have an ideal working user environment - which is how the original implem worked, then move to available device checks. Perhaps move this block to above/below checking the length of our available devices list?

This moves the permission check to after the devices have been discovered. It then checks the real needed group for the first device and checks if user running the process is in the group.