@@ -132,7 +132,8 @@ bool find_device( rs2::context const & ctx,
132
132
eth_config & config,
133
133
rs2::cli::value< std::string > & sn_arg,
134
134
bool const golden,
135
- std::set< std::string > & devices_looked_at )
135
+ std::set< std::string > & devices_looked_at,
136
+ bool & recovery )
136
137
{
137
138
auto device_list = ctx.query_devices ();
138
139
auto const n_devices = device_list.size ();
@@ -148,7 +149,11 @@ bool find_device( rs2::context const & ctx,
148
149
if ( ! devices_looked_at.insert ( sn ).second )
149
150
continue ; // insert failed: device was already looked at
150
151
LOG_DEBUG ( " trying " << describe_device ( possible_device ) );
151
- config = get_eth_config ( possible_device, golden );
152
+ std::string name = possible_device.get_info ( RS2_CAMERA_INFO_NAME );
153
+ if ( name.find ( " Recovery" ) != std::string::npos )
154
+ recovery = true ;
155
+ else
156
+ config = get_eth_config ( possible_device, golden );
152
157
if ( device )
153
158
more_than_one_device = true ;
154
159
list_device ( device = possible_device );
@@ -228,24 +233,49 @@ try
228
233
}
229
234
return EXIT_SUCCESS;
230
235
}
236
+
237
+ // Enable DDS in future runs
238
+ auto const filename = rsutils::os::get_special_folder ( rsutils::os::special_folder::app_data ) + RS2_CONFIG_FILENAME;
239
+ auto config = rsutils::json_config::load_from_file ( filename );
240
+ if ( ! config )
241
+ config = json::object ();
242
+
243
+ if ( ! config.nested ( " context" , " dds" , " enabled" ).default_value ( false ) )
244
+ {
245
+ config[" context" ][" dds" ][" enabled" ] = true ;
246
+ try
247
+ {
248
+ std::ofstream out ( filename );
249
+ out << std::setw ( 2 ) << config;
250
+ out.close ();
251
+ INFO ( " DDS is now enabled by default in " RS2_CONFIG_FILENAME );
252
+ }
253
+ catch ( std::exception const & e )
254
+ {
255
+ std::cout << " -W- FAILED to enable DDS by default: " << e.what () << std::endl;
256
+ }
257
+ }
231
258
232
259
bool const golden = golden_arg.isSet ();
233
260
234
261
// Create a RealSense context and look for a device
235
- settings[" dds" ][" enabled" ] = true ;
236
262
rs2::context ctx ( settings.dump () );
237
263
238
264
rs2::device device;
239
265
eth_config current;
240
266
std::set< std::string > devices_looked_at;
241
- if ( ! find_device ( ctx, device, current, sn_arg, golden, devices_looked_at ) )
267
+ bool recovery = false ;
268
+ if ( ! find_device ( ctx, device, current, sn_arg, golden, devices_looked_at, recovery ) )
242
269
{
243
270
if ( sn_arg.isSet () )
244
271
throw std::runtime_error ( " Device not found or does not support Eth" );
245
272
246
273
throw std::runtime_error ( " No device found supporting Eth" );
247
274
}
248
275
276
+ if ( recovery )
277
+ throw std::runtime_error ( " Recovery devices don't support Ethernet params configuration" );
278
+
249
279
eth_config requested ( current );
250
280
if ( golden || factory_reset_arg.isSet () || reset_arg.isSet () )
251
281
{
357
387
else if ( requested == current )
358
388
{
359
389
LOG_DEBUG ( " nothing to do" );
360
-
361
- // When running with no arguments, and DDS is disabled, and we actually find a DDS device, we automatically
362
- // enable DDS in future runs:
363
- if ( device.get_type () == " DDS" )
364
- {
365
- auto const filename
366
- = rsutils::os::get_special_folder ( rsutils::os::special_folder::app_data ) + RS2_CONFIG_FILENAME;
367
- auto config = rsutils::json_config::load_from_file ( filename );
368
-
369
- bool enabled;
370
- if ( ! config.nested ( " context" , " dds" , " enabled" ).get_ex ( enabled ) )
371
- {
372
- config[" context" ][" dds" ][" enabled" ] = true ;
373
- try
374
- {
375
- std::ofstream out ( filename );
376
- out << std::setw ( 2 ) << config;
377
- out.close ();
378
- INFO ( " DDS is now enabled by default in " RS2_CONFIG_FILENAME );
379
- }
380
- catch ( std::exception const & e )
381
- {
382
- std::cout << " -W- " << " FAILED to enable DDS by default: " << e.what () << std::endl;
383
- }
384
- }
385
- else
386
- {
387
- LOG_DEBUG ( " 'dds/enabled' was pre-set in configuration file (to " << enabled << " ); no changes made" );
388
- }
389
- }
390
390
}
391
391
else
392
392
{
0 commit comments