1
- using System . Collections . Immutable ;
2
- using System . Drawing ;
3
- using System . Net ;
4
- using System . Net . NetworkInformation ;
5
- using System . Net . Sockets ;
6
- using System . Text . RegularExpressions ;
1
+ using DnsClient ;
7
2
using FFMpegCore ;
8
3
using NetTopologySuite . IO ;
4
+ using OpenpilotSdk . Exceptions ;
9
5
using OpenpilotSdk . Git ;
10
6
using OpenpilotSdk . OpenPilot ;
7
+ using OpenpilotSdk . OpenPilot . FileTypes ;
11
8
using OpenpilotSdk . OpenPilot . Fork ;
12
- using Renci . SshNet ;
13
- using Renci . SshNet . Sftp ;
9
+ using OpenpilotSdk . OpenPilot . Media ;
10
+ using OpenpilotSdk . OpenPilot . Segment ;
14
11
using OpenpilotSdk . Sftp ;
12
+ using Renci . SshNet ;
15
13
using Renci . SshNet . Common ;
14
+ using Renci . SshNet . Sftp ;
16
15
using Serilog ;
16
+ using System . Collections . Immutable ;
17
+ using System . Drawing ;
17
18
using System . Globalization ;
19
+ using System . Net ;
20
+ using System . Net . NetworkInformation ;
21
+ using System . Net . Sockets ;
18
22
using System . Runtime . CompilerServices ;
19
- using OpenpilotSdk . Exceptions ;
20
- using OpenpilotSdk . OpenPilot . Segment ;
21
- using DnsClient ;
22
- using OpenpilotSdk . OpenPilot . FileTypes ;
23
- using OpenpilotSdk . OpenPilot . Media ;
23
+ using System . Text . RegularExpressions ;
24
24
25
25
namespace OpenpilotSdk . Hardware
26
26
{
@@ -46,7 +46,7 @@ public abstract class OpenpilotDevice
46
46
public virtual string ShutdownCommand => @"am start -n android/com.android.internal.app.ShutdownActivity" ;
47
47
public virtual string FlashCommand => @"pkill -f openpilot & cd /data/openpilot/panda/board && ./recover.sh" ;
48
48
public virtual string InstallEmuCommand => @"cd /data/openpilot && echo 'y' | bash <(curl -fsSL install.emu.sh) && source /data/community/.bashrc" ;
49
- public virtual string GitCloneCommand => @"cd /data && rm -rf openpilot; git clone -b {1} --depth 1 --single-branch --progress --recurse-submodules --shallow-submodules {0} openpilot" ;
49
+ public virtual string GitCloneCommand => @"sudo systemctl stop comma || {{ echo ""ERROR: Failed to stop 'comma' service"" >&2; exit 1; }} && cd /data || {{ echo ""ERROR: Directory '/data' not found or inaccessible"" >&2; exit 1; }} && rm -rf openpilot || {{ echo ""ERROR: Failed to remove old openpilot folder"" >&2; exit 1; }} && git clone -b {1} --depth 1 --single-branch --progress --recurse-submodules --shallow-submodules https://github.com/ {0}/{2}.git openpilot || {{ echo ""ERROR: Git clone failed. Check URL, branch, or network."" >&2; exit 1; }} " ;
50
50
51
51
public abstract IReadOnlyDictionary < CameraType , Camera > Cameras { get ; }
52
52
@@ -206,7 +206,7 @@ public async Task<CombinedStream> GetVideoStream(Route route, Camera camera)
206
206
207
207
public async Task < CombinedStreamCollection > GetVideoStreams ( Route route )
208
208
{
209
- return new CombinedStreamCollection ( this , route ) ;
209
+ return new CombinedStreamCollection ( this , route , true ) ;
210
210
}
211
211
212
212
public async Task ExportRouteAsync ( string exportPath , Route route , Camera camera , bool combineSegments = false , IProgress < OpenPilot . Camera . Progress > ? progress = null )
@@ -682,7 +682,7 @@ public async Task<GpxFile> GenerateGpxFileAsync(Route route, IProgress<int>? pro
682
682
try
683
683
{
684
684
directoryListing = ( await SftpClient . ListDirectoryAsync ( StorageDirectory , cancellationToken )
685
- . ConfigureAwait ( false ) ) ;
685
+ . ConfigureAwait ( false ) ) ;
686
686
}
687
687
catch ( SftpPathNotFoundException )
688
688
{
@@ -1074,7 +1074,8 @@ public static async IAsyncEnumerable<OpenpilotDevice> DiscoverAsync()
1074
1074
//~26ms
1075
1075
try
1076
1076
{
1077
- using ( var command = sshClient . CreateCommand ( "hostname" ) )
1077
+ //new command here gives the model
1078
+ using ( var command = sshClient . CreateCommand ( "cat /sys/firmware/devicetree/base/model" ) )
1078
1079
{
1079
1080
hostName = await Task . Factory . FromAsync ( command . BeginExecute ( ) , command . EndExecute ) . ConfigureAwait ( false ) ;
1080
1081
if ( hostName != null && ( hostName . StartsWith ( "comma" ) || hostName . Equals ( "tici" ) ) )
@@ -1196,7 +1197,7 @@ public virtual async Task<ForkResult> InstallForkAsync(string username, string b
1196
1197
await ConnectSshAsync ( ) . ConfigureAwait ( false ) ;
1197
1198
1198
1199
var installCommand =
1199
- string . Format ( @"cd /data && rm -rf openpilot ; git clone -b {1} --depth 1 --single-branch --progress --recurse-submodules --shallow-submodules https://github.com/{0}/{2}.git openpilot" , username , branch , repository ) ;
1200
+ string . Format ( GitCloneCommand , username , branch , repository ) ;
1200
1201
1201
1202
var progressRegex = new Regex ( @"\d+(?=%)" , RegexOptions . Compiled ) ;
1202
1203
int previousProgress = 0 ;
@@ -1253,8 +1254,8 @@ public virtual async Task<ForkResult> InstallForkAsync(string username, string b
1253
1254
await ConnectSshAsync ( ) . ConfigureAwait ( false ) ;
1254
1255
1255
1256
var installCommand =
1256
- string . Format ( @"cd /data && rm -rf openpilot; git clone -b {1} --depth 1 --single-branch --recurse-submodules --shallow-submodules https://github.com/{0}/{2}.git openpilot" , username , branch , repository ) ;
1257
-
1257
+ string . Format ( GitCloneCommand , username , branch , repository ) ;
1258
+
1258
1259
using ( var command = SshClient . CreateCommand ( installCommand ) )
1259
1260
{
1260
1261
var result = await Task . Factory . FromAsync ( command . BeginExecute ( ) , command . EndExecute ) . ConfigureAwait ( false ) ;
0 commit comments