|
|
|
|
236
|
char ctrl_name[NAME_MAX];
|
236
|
char ctrl_name[NAME_MAX];
|
237
|
bool need_value = false;
|
237
|
bool need_value = false;
|
238
|
bool need_target = true; // default cmd is get brightness
|
238
|
bool need_target = true; // default cmd is get brightness
|
|
|
239
|
+ bool specified_target = false;
|
239
|
snprintf(ctrl_name, sizeof(ctrl_name), "%s", "sysfs/backlight/auto");
|
240
|
snprintf(ctrl_name, sizeof(ctrl_name), "%s", "sysfs/backlight/auto");
|
240
|
|
241
|
|
241
|
while((curr_arg = getopt(argc, argv, "HhVGSLMNPAUOIv:s:r")) != -1)
|
242
|
while((curr_arg = getopt(argc, argv, "HhVGSLMNPAUOIv:s:r")) != -1)
|
|
|
|
|
263
|
break;
|
264
|
break;
|
264
|
case 's':
|
265
|
case 's':
|
265
|
snprintf(ctrl_name, sizeof(ctrl_name), "%s", optarg);
|
266
|
snprintf(ctrl_name, sizeof(ctrl_name), "%s", optarg);
|
|
|
267
|
+ specified_target = true;
|
266
|
break;
|
268
|
break;
|
267
|
case 'r':
|
269
|
case 'r':
|
268
|
ctx->run_params.raw_mode = true;
|
270
|
ctx->run_params.raw_mode = true;
|
|
|
|
|
332
|
light_device_target_t *curr_target = light_find_device_target(ctx, ctrl_name);
|
334
|
light_device_target_t *curr_target = light_find_device_target(ctx, ctrl_name);
|
333
|
if(curr_target == NULL)
|
335
|
if(curr_target == NULL)
|
334
|
{
|
336
|
{
|
335
|
- fprintf(stderr, "couldn't find a device target at the path \"%s\". Use -L to find one.\n\n", ctrl_name);
|
|
|
336
|
- return false;
|
|
|
|
|
337
|
+ if(specified_target)
|
|
|
338
|
+ {
|
|
|
339
|
+ fprintf(stderr, "We couldn't find the specified device target at the path \"%s\". Use -L to find one.\n\n", ctrl_name);
|
|
|
340
|
+ return false;
|
|
|
341
|
+ }
|
|
|
342
|
+ else
|
|
|
343
|
+ {
|
|
|
344
|
+ fprintf(stderr, "No backlight controller was found, so we could not decide an automatic target. The current command will have no effect. Please use -L to find a target and then specify it with -s.\n\n");
|
|
|
345
|
+ curr_target = light_find_device_target(ctx, "util/test/dryrun");
|
|
|
346
|
+ }
|
337
|
}
|
347
|
}
|
338
|
|
348
|
|
339
|
ctx->run_params.device_target = curr_target;
|
349
|
ctx->run_params.device_target = curr_target;
|