File tree Expand file tree Collapse file tree 3 files changed +41
-1
lines changed
nanoFirmwareFlasher.Library Expand file tree Collapse file tree 3 files changed +41
-1
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,16 @@ public class JLinkDevice : JLinkCli
3636 /// </summary>
3737 public string DeviceCPU { get ; }
3838
39+ /// <summary>
40+ /// Firmware details of the connected J-Link probe.
41+ /// </summary>
42+ public string Firmare { get ; } = "N.A." ;
43+
44+ /// <summary>
45+ /// Hardware details of the connected J-Link probe.
46+ /// </summary>
47+ public string Hardware { get ; } = "N.A." ;
48+
3949 /// <summary>
4050 /// Creates a new <see cref="JLinkDevice"/>.
4151 /// </summary>
@@ -79,12 +89,24 @@ public JLinkDevice(string probeId = null)
7989 }
8090
8191 // parse the output to fill in the details
82- var match = Regex . Match ( cliOutput , $ "(Device \" )(?<deviceid>\\ w*)(\" selected.)" ) ;
92+ var match = Regex . Match ( cliOutput , @ "(Device "" )(?<deviceid>\w*)("" selected\.)|(Firmware: )(?<firmware>.*)" , RegexOptions . Multiline ) ;
8393 if ( match . Success )
8494 {
8595 // grab details
8696 DeviceId = match . Groups [ "deviceid" ] . ToString ( ) . Trim ( ) ;
97+
98+ if ( match . Groups [ "firmware" ] != null )
99+ {
100+ Firmare = match . Groups [ "firmware" ] . ToString ( ) . Trim ( ) ;
101+ }
102+ }
103+
104+ match = Regex . Match ( cliOutput , @"(Hardware version: )(?<hardware>.*)" , RegexOptions . Multiline ) ;
105+ if ( match . Success && match . Groups [ "hardware" ] != null )
106+ {
107+ Hardware = match . Groups [ "hardware" ] . ToString ( ) . Trim ( ) ;
87108 }
109+
88110 match = Regex . Match ( cliOutput , $ "(Found )(?<devicecpu>.*)(,)") ;
89111 if ( match . Success )
90112 {
Original file line number Diff line number Diff line change @@ -130,6 +130,12 @@ public static async System.Threading.Tasks.Task<ExitCodes> UpdateFirmwareAsync(
130130 Console . ForegroundColor = ConsoleColor . White ;
131131 }
132132
133+ if ( verbosity == VerbosityLevel . Diagnostic )
134+ {
135+ Console . WriteLine ( $ "Firmware: { jlinkDevice . Firmare } ") ;
136+ Console . WriteLine ( $ "Hardware: { jlinkDevice . Hardware } ") ;
137+ }
138+
133139 if ( fitCheck )
134140 {
135141 Console . ForegroundColor = ConsoleColor . Yellow ;
@@ -175,6 +181,12 @@ public static ExitCodes MassErase(
175181 Console . WriteLine ( $ "Connected to J-Link device with ID { jlinkDevice . ProbeId } ") ;
176182 }
177183
184+ if ( verbosity == VerbosityLevel . Diagnostic )
185+ {
186+ Console . WriteLine ( $ "Firmware: { jlinkDevice . Firmare } ") ;
187+ Console . WriteLine ( $ "Hardware: { jlinkDevice . Hardware } ") ;
188+ }
189+
178190 // set verbosity
179191 jlinkDevice . Verbosity = verbosity ;
180192
Original file line number Diff line number Diff line change @@ -1295,6 +1295,12 @@ static async Task RunOptionsAndReturnExitCodeAsync(Options o)
12951295 Console . WriteLine ( $ "Connected to J-Link device with ID { jlinkDevice . ProbeId } ") ;
12961296 }
12971297
1298+ if ( _verbosityLevel == VerbosityLevel . Diagnostic )
1299+ {
1300+ Console . WriteLine ( $ "Firmware: { jlinkDevice . Firmare } ") ;
1301+ Console . WriteLine ( $ "Hardware: { jlinkDevice . Hardware } ") ;
1302+ }
1303+
12981304 // set VCP baud rate (if requested)
12991305 if ( o . SetVcpBaudRate . HasValue )
13001306 {
You can’t perform that action at this time.
0 commit comments