|
@@ -344,8 +344,14 @@ void prepare_cmd_entry(struct videohub_data *d, struct vcmd_entry *e) {
|
344
|
344
|
}
|
345
|
345
|
}
|
346
|
346
|
|
|
347
|
+ // Allow port_noX to be used as index into ->port[]
|
|
348
|
+ e->port_no1 -= 1;
|
|
349
|
+ e->port_no2 -= 1;
|
|
350
|
+ if (e->clear_port)
|
|
351
|
+ e->port_no2 = NO_PORT;
|
|
352
|
+
|
347
|
353
|
if (e->cmd->type == PARSE_LOCK) {
|
348
|
|
- e->lock = s_port->port[e->port_no1 - 1].lock;
|
|
354
|
+ e->lock = s_port->port[e->port_no1].lock;
|
349
|
355
|
}
|
350
|
356
|
}
|
351
|
357
|
|
|
@@ -371,19 +377,19 @@ void format_cmd_text(struct vcmd_entry *e, char *buf, unsigned int bufsz) {
|
371
|
377
|
switch (e->cmd->type) {
|
372
|
378
|
case PARSE_LABEL:
|
373
|
379
|
snprintf(buf, bufsz, "%s:\n%u %s\n\n", videohub_commands_text[e->cmd->cmd],
|
374
|
|
- e->port_no1 - 1, e->param2);
|
|
380
|
+ e->port_no1, e->param2);
|
375
|
381
|
break;
|
376
|
382
|
case PARSE_LOCK:
|
377
|
383
|
snprintf(buf, bufsz, "%s:\n%u %s\n\n", videohub_commands_text[e->cmd->cmd],
|
378
|
|
- e->port_no1 - 1, e->do_lock ? "O" : (e->lock == PORT_LOCKED_OTHER ? "F" : "U"));
|
|
384
|
+ e->port_no1, e->do_lock ? "O" : (e->lock == PORT_LOCKED_OTHER ? "F" : "U"));
|
379
|
385
|
break;
|
380
|
386
|
case PARSE_ROUTE:
|
381
|
|
- snprintf(buf, bufsz, "%s:\n%u %u\n\n", videohub_commands_text[e->cmd->cmd],
|
382
|
|
- e->port_no1 - 1, e->port_no2 - 1);
|
|
387
|
+ snprintf(buf, bufsz, "%s:\n%u %d\n\n", videohub_commands_text[e->cmd->cmd],
|
|
388
|
+ e->port_no1, (e->port_no2 == NO_PORT ? -1 : (int)e->port_no2));
|
383
|
389
|
break;
|
384
|
390
|
case PARSE_DIR:
|
385
|
391
|
snprintf(buf, bufsz, "%s:\n%u %s\n\n", videohub_commands_text[e->cmd->cmd],
|
386
|
|
- e->port_no1 - 1, dir2cmd(e->direction));
|
|
392
|
+ e->port_no1, dir2cmd(e->direction));
|
387
|
393
|
break;
|
388
|
394
|
default: break;
|
389
|
395
|
}
|
|
@@ -398,7 +404,7 @@ void show_cmd(struct videohub_data *d, struct vcmd_entry *e) {
|
398
|
404
|
printf("%srename %s %d \"%s\" to \"%s\"\n",
|
399
|
405
|
prefix,
|
400
|
406
|
e->cmd->port_id1,
|
401
|
|
- e->port_no1, s_port->port[e->port_no1 - 1].name,
|
|
407
|
+ e->port_no1 + 1, s_port->port[e->port_no1].name,
|
402
|
408
|
e->param2
|
403
|
409
|
);
|
404
|
410
|
break;
|
|
@@ -407,23 +413,41 @@ void show_cmd(struct videohub_data *d, struct vcmd_entry *e) {
|
407
|
413
|
prefix,
|
408
|
414
|
e->do_lock ? "lock" : (e->lock == PORT_LOCKED_OTHER ? "force unlock" : "unlock"),
|
409
|
415
|
e->cmd->port_id1,
|
410
|
|
- e->port_no1, s_port->port[e->port_no1 - 1].name
|
|
416
|
+ e->port_no1 + 1, s_port->port[e->port_no1].name
|
411
|
417
|
);
|
412
|
418
|
break;
|
413
|
419
|
case PARSE_ROUTE:
|
|
420
|
+ if (e->port_no2 == NO_PORT) {
|
|
421
|
+ printf("%sdisconnect %s %d \"%s\"\n",
|
|
422
|
+ prefix,
|
|
423
|
+ e->cmd->port_id1,
|
|
424
|
+ e->port_no1 + 1, s_port->port[e->port_no1].name
|
|
425
|
+ );
|
|
426
|
+ break;
|
|
427
|
+ }
|
|
428
|
+ if (e->cmd->cmd == CMD_SERIAL_PORT_ROUTING) {
|
|
429
|
+ printf("%sconnect %s %d \"%s\" to %s %d \"%s\"\n",
|
|
430
|
+ prefix,
|
|
431
|
+ e->cmd->port_id1,
|
|
432
|
+ e->port_no1 + 1, s_port->port[e->port_no1].name,
|
|
433
|
+ e->cmd->port_id2,
|
|
434
|
+ e->port_no2 + 1, d_port->port [e->port_no2].name
|
|
435
|
+ );
|
|
436
|
+ break;
|
|
437
|
+ }
|
414
|
438
|
printf("%sset %s %d \"%s\" to read from %s %d \"%s\"\n",
|
415
|
439
|
prefix,
|
416
|
440
|
e->cmd->port_id1,
|
417
|
|
- e->port_no1, s_port->port[e->port_no1 - 1].name,
|
|
441
|
+ e->port_no1 + 1, s_port->port[e->port_no1].name,
|
418
|
442
|
e->cmd->port_id2,
|
419
|
|
- e->port_no2, d_port->port [e->port_no2 - 1].name
|
|
443
|
+ e->port_no2 + 1, d_port->port [e->port_no2].name
|
420
|
444
|
);
|
421
|
445
|
break;
|
422
|
446
|
case PARSE_DIR:
|
423
|
447
|
printf("%sset %s %d \"%s\" direction to %s\n",
|
424
|
448
|
prefix,
|
425
|
449
|
e->cmd->port_id1,
|
426
|
|
- e->port_no1, s_port->port[e->port_no1 - 1].name,
|
|
450
|
+ e->port_no1 + 1, s_port->port[e->port_no1].name,
|
427
|
451
|
dir2txt(e->direction)
|
428
|
452
|
);
|
429
|
453
|
break;
|