-
Notifications
You must be signed in to change notification settings - Fork 182
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
Create timesync JNI for testing client #1433
Draft
mcm001
wants to merge
26
commits into
PhotonVision:master
Choose a base branch
from
mcm001:20240923_timesyncjni
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
19ccdcd
half-working not-yet-in-jar
mcm001 c800917
actually do the thing
mcm001 a212cfc
Add comment
mcm001 7cbb44c
clean up diff
mcm001 fef8f18
Add timesync client/server
mcm001 dd9c619
Downgrade to wpilib 2024.3.2-isms
mcm001 3dfc14f
Fix things
mcm001 e898afa
Make unit test build!
mcm001 a4ba343
Yeet (don't forget to use the correct jdk)
mcm001 be12be1
Actually use outputs folder
mcm001 bae1eb1
remove comments
mcm001 4330fbe
Adjust output folder name
mcm001 7e30ff6
Split Platform/PlatformUtils
mcm001 f2afdd3
Remove pbuildalldesktop
mcm001 cd92e5f
Hack in time sync
mcm001 f9a2b8d
Latest updates from my tests
mcm001 b98df86
Fix tests
mcm001 1cf4fe1
oops
mcm001 787c053
Comment out thing
mcm001 c4baefb
Broken attempt at -as-needed
mcm001 1c4cdb3
Only link to stuff I need
mcm001 0bc13fe
Actually load wpilibc
mcm001 d183413
oops
mcm001 5a3aaf7
yeet
mcm001 c510134
run lint
mcm001 d020419
fix tests
mcm001 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
photon-core/src/main/java/org/photonvision/common/hardware/PlatformUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
* Copyright (C) Photon Vision. | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package org.photonvision.common.hardware; | ||
|
||
import java.io.IOException; | ||
import org.photonvision.common.util.ShellExec; | ||
|
||
@SuppressWarnings("unused") | ||
public class PlatformUtils { | ||
private static final ShellExec shell = new ShellExec(true, false); | ||
private static final boolean isRoot = checkForRoot(); | ||
|
||
@SuppressWarnings("StatementWithEmptyBody") | ||
private static boolean checkForRoot() { | ||
if (Platform.isLinux()) { | ||
try { | ||
shell.executeBashCommand("id -u"); | ||
} catch (IOException e) { | ||
e.printStackTrace(); | ||
} | ||
|
||
while (!shell.isOutputCompleted()) { | ||
// TODO: add timeout | ||
} | ||
|
||
if (shell.getExitCode() == 0) { | ||
return shell.getOutput().split("\n")[0].equals("0"); | ||
} | ||
|
||
} else { | ||
return true; | ||
} | ||
return false; | ||
} | ||
|
||
public static boolean isRoot() { | ||
return isRoot; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These build changes could be merged with or without the rest of this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This hasn't been rebased on main yet, but we merged a subset already