videohubctrl can be used to control Blackmagic Design Videohub SDI router device over the network.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

cmd.c 16KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490
  1. /*
  2. * === Commands processing ===
  3. *
  4. * Blackmagic Design Videohub control application
  5. * Copyright (C) 2014 Unix Solutions Ltd.
  6. * Written by Georgi Chorbadzhiyski
  7. *
  8. * Released under MIT license.
  9. * See LICENSE-MIT.txt for license terms.
  10. *
  11. */
  12. #include <stdio.h>
  13. #include <stdlib.h>
  14. #include <stddef.h>
  15. #include <string.h>
  16. #include "data.h"
  17. #include "cmd.h"
  18. #include "util.h"
  19. const char *videohub_commands_text[NUM_COMMANDS] = {
  20. [CMD_PROTOCOL_PREAMBLE] = "PROTOCOL PREAMBLE",
  21. [CMD_VIDEOHUB_DEVICE] = "VIDEOHUB DEVICE",
  22. [CMD_INPUT_LABELS] = "INPUT LABELS",
  23. [CMD_OUTPUT_LABELS] = "OUTPUT LABELS",
  24. [CMD_VIDEO_OUTPUT_LOCKS] = "VIDEO OUTPUT LOCKS",
  25. [CMD_VIDEO_OUTPUT_ROUTING] = "VIDEO OUTPUT ROUTING",
  26. [CMD_VIDEO_INPUT_STATUS] = "VIDEO INPUT STATUS",
  27. [CMD_VIDEO_OUTPUT_STATUS] = "VIDEO OUTPUT STATUS",
  28. [CMD_MONITORING_OUTPUT_LABELS] = "MONITORING OUTPUT LABELS",
  29. [CMD_MONITORING_OUTPUT_LOCKS] = "MONITORING OUTPUT LOCKS",
  30. [CMD_MONITORING_OUTPUT_ROUTING] = "VIDEO MONITORING OUTPUT ROUTING",
  31. [CMD_SERIAL_PORT_LABELS] = "SERIAL PORT LABELS",
  32. [CMD_SERIAL_PORT_ROUTING] = "SERIAL PORT ROUTING",
  33. [CMD_SERIAL_PORT_LOCKS] = "SERIAL PORT LOCKS",
  34. [CMD_SERIAL_PORT_STATUS] = "SERIAL PORT STATUS",
  35. [CMD_SERIAL_PORT_DIRECTIONS] = "SERIAL PORT DIRECTIONS",
  36. [CMD_PROCESSING_UNIT_ROUTING]= "PROCESSING UNIT ROUTING",
  37. [CMD_PROCESSING_UNIT_LOCKS] = "PROCESSING UNIT LOCKS",
  38. [CMD_PING] = "PING",
  39. [CMD_ACK] = "ACK",
  40. [CMD_NAK] = "NAK",
  41. };
  42. #define OFS(X) offsetof(struct videohub_data, X)
  43. struct videohub_commands videohub_commands[NUM_COMMANDS] = {
  44. [CMD_PROTOCOL_PREAMBLE] = { .cmd = CMD_PROTOCOL_PREAMBLE , .type = PARSE_CUSTOM },
  45. [CMD_VIDEOHUB_DEVICE] = { .cmd = CMD_VIDEOHUB_DEVICE , .type = PARSE_CUSTOM },
  46. [CMD_INPUT_LABELS] = { .cmd = CMD_INPUT_LABELS , .type = PARSE_LABEL,
  47. .ports1 = OFS(inputs),
  48. .port_id1 = "video input",
  49. .opt_prefix = "vi",
  50. },
  51. [CMD_OUTPUT_LABELS] = { .cmd = CMD_OUTPUT_LABELS , .type = PARSE_LABEL,
  52. .ports1 = OFS(outputs),
  53. .port_id1 = "video output",
  54. .opt_prefix = "vo",
  55. },
  56. [CMD_VIDEO_OUTPUT_LOCKS] = { .cmd = CMD_VIDEO_OUTPUT_LOCKS , .type = PARSE_LOCK,
  57. .ports1 = OFS(outputs),
  58. .port_id1 = "video output",
  59. .opt_prefix = "vo",
  60. },
  61. [CMD_VIDEO_OUTPUT_ROUTING] = { .cmd = CMD_VIDEO_OUTPUT_ROUTING, .type = PARSE_ROUTE,
  62. .ports1 = OFS(outputs),
  63. .ports2 = OFS(inputs),
  64. .port_id1 = "video output",
  65. .port_id2 = "video input",
  66. .opt_prefix = "vo",
  67. },
  68. [CMD_VIDEO_INPUT_STATUS] = { .cmd = CMD_VIDEO_INPUT_STATUS , .type = PARSE_STATUS,
  69. .ports1 = OFS(inputs),
  70. .port_id1 = "video input",
  71. .opt_prefix = "vi",
  72. },
  73. [CMD_VIDEO_OUTPUT_STATUS] = { .cmd = CMD_VIDEO_OUTPUT_STATUS , .type = PARSE_STATUS,
  74. .ports1 = OFS(outputs),
  75. .port_id1 = "video output",
  76. .opt_prefix = "vo",
  77. },
  78. [CMD_MONITORING_OUTPUT_LABELS] = { .cmd = CMD_MONITORING_OUTPUT_LABELS , .type = PARSE_LABEL,
  79. .ports1 = OFS(mon_outputs),
  80. .port_id1 = "monitoring output",
  81. .opt_prefix = "mo",
  82. },
  83. [CMD_MONITORING_OUTPUT_LOCKS] = { .cmd = CMD_MONITORING_OUTPUT_LOCKS , .type = PARSE_LOCK,
  84. .ports1 = OFS(mon_outputs),
  85. .port_id1 = "monitoring output",
  86. .opt_prefix = "mo",
  87. },
  88. [CMD_MONITORING_OUTPUT_ROUTING] = { .cmd = CMD_MONITORING_OUTPUT_ROUTING, .type = PARSE_ROUTE,
  89. .ports1 = OFS(mon_outputs),
  90. .ports2 = OFS(inputs),
  91. .port_id1 = "monitoring output",
  92. .port_id2 = "video input",
  93. .opt_prefix = "mo",
  94. },
  95. [CMD_SERIAL_PORT_LABELS] = { .cmd = CMD_SERIAL_PORT_LABELS, .type = PARSE_LABEL,
  96. .ports1 = OFS(serial),
  97. .port_id1 = "serial",
  98. .opt_prefix = "se",
  99. },
  100. [CMD_SERIAL_PORT_LOCKS] = { .cmd = CMD_SERIAL_PORT_LOCKS , .type = PARSE_LOCK,
  101. .ports1 = OFS(serial),
  102. .port_id1 = "serial",
  103. .opt_prefix = "se",
  104. },
  105. [CMD_SERIAL_PORT_ROUTING] = { .cmd = CMD_SERIAL_PORT_ROUTING, .type = PARSE_ROUTE,
  106. .ports1 = OFS(serial),
  107. .ports2 = OFS(serial),
  108. .port_id1 = "serial",
  109. .port_id2 = "serial",
  110. .opt_prefix = "se",
  111. .allow_disconnect = true,
  112. },
  113. [CMD_SERIAL_PORT_STATUS] = { .cmd = CMD_SERIAL_PORT_STATUS , .type = PARSE_STATUS,
  114. .ports1 = OFS(serial),
  115. .port_id1 = "serial",
  116. .opt_prefix = "se",
  117. },
  118. [CMD_SERIAL_PORT_DIRECTIONS] = { .cmd = CMD_SERIAL_PORT_DIRECTIONS, .type = PARSE_DIR,
  119. .ports1 = OFS(serial),
  120. .port_id1 = "serial",
  121. .opt_prefix = "se",
  122. },
  123. [CMD_PROCESSING_UNIT_ROUTING] = { .cmd = CMD_PROCESSING_UNIT_ROUTING, .type = PARSE_ROUTE,
  124. .ports1 = OFS(proc_units),
  125. .ports2 = OFS(inputs),
  126. .port_id1 = "proc unit",
  127. .port_id2 = "input",
  128. .opt_prefix = "pu",
  129. .allow_disconnect = true,
  130. },
  131. [CMD_PROCESSING_UNIT_LOCKS] = { .cmd = CMD_PROCESSING_UNIT_LOCKS, .type = PARSE_LOCK,
  132. .ports1 = OFS(proc_units),
  133. .port_id1 = "proc unit",
  134. .opt_prefix = "pu",
  135. },
  136. [CMD_PING] = { .cmd = CMD_PING , .type = PARSE_NONE },
  137. [CMD_ACK] = { .cmd = CMD_ACK , .type = PARSE_NONE },
  138. [CMD_NAK] = { .cmd = CMD_NAK , .type = PARSE_NONE },
  139. };
  140. static char *parse_text(char *line, char *cmd) {
  141. char *parsed_text = strstr(line, cmd);
  142. if (parsed_text == line) {
  143. return parsed_text + strlen(cmd);
  144. }
  145. return NULL;
  146. }
  147. bool parse_command(struct videohub_data *d, char *cmd) {
  148. unsigned int i;
  149. bool ret = true;
  150. if (!strlen(cmd))
  151. return false;
  152. struct videohub_commands *v = NULL;
  153. const char *cmd_txt = NULL;
  154. for (i = 0; i < NUM_COMMANDS; i++) {
  155. const char *cmd_text = videohub_commands_text[i];
  156. if (strstr(cmd, cmd_text) == cmd) {
  157. v = &videohub_commands[i];
  158. cmd_txt = videohub_commands_text[i];
  159. break;
  160. }
  161. }
  162. if (!v) {
  163. q("WARNING: Videohub sent unknown command!\n");
  164. q(" Please report this command to author's email: georgi@unixsol.org\n");
  165. q(" You may use -q or --quiet to suppress the message.\n");
  166. q("---------8<-----------8<----------- cut here ---------8<------------8<---------\n");
  167. q("%s\n", cmd);
  168. q("---------8<-----------8<----------- cut here ---------8<------------8<---------\n");
  169. return false;
  170. }
  171. d("debug: Got '%s' command.\n", cmd_txt);
  172. if (debug > 1)
  173. d("----\n%s\n----\n", cmd);
  174. struct port_set *s_port = !v->ports1 ? NULL : (void *)d + v->ports1;
  175. struct port_set *d_port = !v->ports2 ? NULL : (void *)d + v->ports2;
  176. char *p, *cmd_data = xstrdup( cmd + strlen(cmd_txt) + 2 ); // +2 to compensate for :\n at the end of the command
  177. // Split line by line
  178. char *line, *saveptr = NULL;
  179. for(i = 0, line = strtok_r(cmd_data, "\n", &saveptr); line; line = strtok_r(NULL, "\n", &saveptr), i++) {
  180. // Parse command data response
  181. unsigned int port_num = 0;
  182. unsigned int dest_port_num = 0;
  183. char *port_data = NULL;
  184. if (v->type != PARSE_NONE && v->type != PARSE_CUSTOM) {
  185. port_data = strchr(line, ' ');
  186. if (!port_data)
  187. continue;
  188. port_data[0] = '\0'; // Separate port_num from port_data
  189. port_data++;
  190. port_num = strtoul(line, NULL, 10);
  191. if (port_num + 1 > s_port->num) {
  192. q("WARNING: %s: invalid %s port %u (valid 0..%u)\n", cmd_txt,
  193. v->port_id1, port_num, s_port->num - 1);
  194. continue;
  195. }
  196. }
  197. switch (v->type) {
  198. case PARSE_LABEL:
  199. snprintf(s_port->port[port_num].name, sizeof(s_port->port[port_num].name), "%s", port_data);
  200. break;
  201. case PARSE_STATUS:
  202. s_port->port[port_num].status = S_UNKNOWN;
  203. bool invalid_status = false;
  204. if (v->cmd == CMD_SERIAL_PORT_STATUS) {
  205. if (streq("RS422", port_data)) s_port->port[port_num].status = S_RS422;
  206. else if (streq("None", port_data)) s_port->port[port_num].status = S_NONE;
  207. else invalid_status = true;
  208. } else {
  209. if (streq("BNC", port_data)) s_port->port[port_num].status = S_BNC;
  210. else if (streq("Optical", port_data)) s_port->port[port_num].status = S_OPTICAL;
  211. else if (streq("None", port_data)) s_port->port[port_num].status = S_NONE;
  212. else if (streq("Thunderbolt", port_data)) s_port->port[port_num].status = S_THUNDERBOLT;
  213. else invalid_status = true;
  214. }
  215. if (invalid_status) {
  216. q("WARNING: %s command returned unknown status: '%s'\n", cmd_txt, port_data);
  217. q("Please report this line to author's email: georgi@unixsol.org\n");
  218. }
  219. break;
  220. case PARSE_DIR:
  221. s_port->port[port_num].direction = DIR_AUTO;
  222. if (streq("control", port_data)) s_port->port[port_num].direction = DIR_CONTROL;
  223. else if (streq("slave", port_data)) s_port->port[port_num].direction = DIR_SLAVE;
  224. else if (streq("auto", port_data)) s_port->port[port_num].direction = DIR_AUTO;
  225. else {
  226. q("WARNING: %s command returned unknown direction: '%s'\n", cmd_txt, port_data);
  227. q("Please report this line to author's email: georgi@unixsol.org\n");
  228. }
  229. break;
  230. case PARSE_ROUTE:
  231. dest_port_num = strtoul(port_data, NULL, 10);
  232. if (dest_port_num == NO_PORT) {
  233. if (v->allow_disconnect) {
  234. s_port->port[port_num].routed_to = dest_port_num;
  235. continue;
  236. } else {
  237. dest_port_num = port_num;
  238. }
  239. }
  240. if (dest_port_num + 1 > d_port->num) {
  241. q("WARNING: %s: invalid %s port %u (valid 0..%u)\n", cmd_txt,
  242. v->port_id2, dest_port_num, d_port->num - 1);
  243. continue;
  244. }
  245. s_port->port[port_num].routed_to = dest_port_num;
  246. break;
  247. case PARSE_LOCK:
  248. switch (port_data[0]) {
  249. case 'O': s_port->port[port_num].lock = PORT_LOCKED; break;
  250. case 'L': s_port->port[port_num].lock = PORT_LOCKED_OTHER; break;
  251. default : s_port->port[port_num].lock = PORT_UNLOCKED; break;
  252. }
  253. break;
  254. default: break;
  255. }
  256. // Parse custom commands
  257. switch (v->cmd) {
  258. case CMD_PROTOCOL_PREAMBLE:
  259. if ((p = parse_text(line, "Version: ")))
  260. snprintf(d->device.protocol_ver, sizeof(d->device.protocol_ver), "%s", p);
  261. break;
  262. case CMD_VIDEOHUB_DEVICE:
  263. if ((p = parse_text(line, "Device present: "))) {
  264. d->device.dev_present = streq(p, "true");
  265. d->device.needs_fw_update = streq(p, "needs_update");
  266. }
  267. else if ((p = parse_text(line, "Model name: ")))
  268. snprintf(d->device.model_name, sizeof(d->device.model_name), "%s", p);
  269. else if ((p = parse_text(line, "Friendly name: ")))
  270. snprintf(d->device.friendly_name, sizeof(d->device.friendly_name), "%s", p);
  271. else if ((p = parse_text(line, "Unique ID: ")))
  272. snprintf(d->device.unique_id, sizeof(d->device.unique_id) , "%s", p);
  273. else if ((p = parse_text(line, "Video inputs: ")))
  274. d->inputs.num = strtoul(p, NULL, 10);
  275. else if ((p = parse_text(line, "Video processing units: ")))
  276. d->proc_units.num = strtoul(p, NULL, 10);
  277. else if ((p = parse_text(line, "Video outputs: ")))
  278. d->outputs.num = strtoul(p, NULL, 10);
  279. else if ((p = parse_text(line, "Video monitoring outputs: ")))
  280. d->mon_outputs.num = strtoul(p, NULL, 10);
  281. else if ((p = parse_text(line, "Serial ports: ")))
  282. d->serial.num = strtoul(p, NULL, 10);
  283. else {
  284. q("WARNING: VIDEOHUB DEVICE command sent unknown line: '%s'\n", line);
  285. q("Please report this line to author's email: georgi@unixsol.org\n");
  286. }
  287. break;
  288. case CMD_NAK:
  289. ret = false;
  290. break;
  291. default: break;
  292. }
  293. }
  294. free(cmd_data);
  295. return ret;
  296. }
  297. int parse_text_buffer(struct videohub_data *d, char *cmd_buffer) {
  298. // The buffer contains only one command, no splitting is needed
  299. if (!strstr(cmd_buffer, "\n\n"))
  300. return parse_command(d, cmd_buffer);
  301. // Split commands and parse them one by one
  302. int ok_commands = 0;
  303. char *buf_copy = xstrdup(cmd_buffer);
  304. char *newcmd, *cmd = buf_copy;
  305. while(1) {
  306. newcmd = strstr(cmd, "\n\n"); // Find next command
  307. if (!newcmd) {
  308. if (parse_command(d, cmd)) // Parse current command
  309. ok_commands++;
  310. break;
  311. }
  312. newcmd[0] = '\0'; // Terminate previous command
  313. if (parse_command(d, cmd)) // Parse previous command
  314. ok_commands++;
  315. cmd = newcmd + 2; // Advance cmd to the next command
  316. }
  317. free(buf_copy);
  318. return ok_commands;
  319. }
  320. // Try to find port with certain name, return 0 on not found, pos + 1 is found
  321. static int get_port_by_name(struct port_set *p, char *name) {
  322. unsigned int i;
  323. for(i = 0; i < p->num; i++) {
  324. if (streq(name, p->port[i].name)) {
  325. return i + 1;
  326. }
  327. }
  328. return 0;
  329. }
  330. // Return 0 on error, number otherwise if it can parse the whole input
  331. static unsigned int my_atoi(char *txt) {
  332. char *endptr = NULL;
  333. if (!txt)
  334. return 0;
  335. unsigned int ret = strtoul(txt, &endptr, 10);
  336. if (endptr == txt || *endptr)
  337. return 0;
  338. return ret;
  339. }
  340. void prepare_cmd_entry(struct videohub_data *d, struct vcmd_entry *e) {
  341. struct port_set *s_port = !e->cmd->ports1 ? NULL : (void *)d + e->cmd->ports1;
  342. struct port_set *d_port = !e->cmd->ports2 ? NULL : (void *)d + e->cmd->ports2;
  343. // All command types needs parsing of the "source port"
  344. e->port_no1 = my_atoi(e->param1);
  345. if (e->port_no1 == 0 || e->port_no1 > s_port->num) {
  346. e->port_no1 = get_port_by_name(s_port, e->param1);
  347. if (!e->port_no1)
  348. die("Unknown %s port number/name: %s", e->cmd->port_id1, e->param1);
  349. }
  350. // ROUTE type needs parsing of the "destination port"
  351. if (e->cmd->type == PARSE_ROUTE) {
  352. e->port_no2 = my_atoi(e->param2);
  353. if (e->port_no2 == 0 || e->port_no2 > d_port->num) {
  354. e->port_no2 = get_port_by_name(d_port, e->param2);
  355. if (!e->port_no2)
  356. die("Unknown %s port number/name: %s", e->cmd->port_id2, e->param2);
  357. }
  358. }
  359. // Allow port_noX to be used as index into ->port[]
  360. e->port_no1 -= 1;
  361. e->port_no2 -= 1;
  362. if (e->clear_port)
  363. e->port_no2 = NO_PORT;
  364. if (e->cmd->type == PARSE_LOCK) {
  365. e->lock = s_port->port[e->port_no1].lock;
  366. }
  367. }
  368. static char *dir2cmd(enum serial_dir dir) {
  369. switch (dir) {
  370. case DIR_CONTROL: return "control";
  371. case DIR_SLAVE : return "slave";
  372. case DIR_AUTO : return "auto";
  373. }
  374. return "auto";
  375. }
  376. static char *dir2txt(enum serial_dir dir) {
  377. switch (dir) {
  378. case DIR_CONTROL: return "IN (Workstation)";
  379. case DIR_SLAVE : return "OUT (Deck)";
  380. case DIR_AUTO : return "AUTO";
  381. }
  382. return "AUTO";
  383. }
  384. void format_cmd_text(struct vcmd_entry *e, char *buf, unsigned int bufsz) {
  385. switch (e->cmd->type) {
  386. case PARSE_LABEL:
  387. snprintf(buf, bufsz, "%s:\n%u %s\n\n", videohub_commands_text[e->cmd->cmd],
  388. e->port_no1, e->param2);
  389. break;
  390. case PARSE_LOCK:
  391. snprintf(buf, bufsz, "%s:\n%u %s\n\n", videohub_commands_text[e->cmd->cmd],
  392. e->port_no1, e->do_lock ? "O" : (e->lock == PORT_LOCKED_OTHER ? "F" : "U"));
  393. break;
  394. case PARSE_ROUTE:
  395. snprintf(buf, bufsz, "%s:\n%u %d\n\n", videohub_commands_text[e->cmd->cmd],
  396. e->port_no1, (e->port_no2 == NO_PORT ? -1 : (int)e->port_no2));
  397. break;
  398. case PARSE_DIR:
  399. snprintf(buf, bufsz, "%s:\n%u %s\n\n", videohub_commands_text[e->cmd->cmd],
  400. e->port_no1, dir2cmd(e->direction));
  401. break;
  402. default: break;
  403. }
  404. }
  405. void show_cmd(struct videohub_data *d, struct vcmd_entry *e) {
  406. struct port_set *s_port = !e->cmd->ports1 ? NULL : (void *)d + e->cmd->ports1;
  407. struct port_set *d_port = !e->cmd->ports2 ? NULL : (void *)d + e->cmd->ports2;
  408. const char *prefix = "videohub: ";
  409. switch (e->cmd->type) {
  410. case PARSE_LABEL:
  411. printf("%srename %s %d \"%s\" to \"%s\"\n",
  412. prefix,
  413. e->cmd->port_id1,
  414. e->port_no1 + 1, s_port->port[e->port_no1].name,
  415. e->param2
  416. );
  417. break;
  418. case PARSE_LOCK:
  419. printf("%s%s %s %d \"%s\"\n",
  420. prefix,
  421. e->do_lock ? "lock" : (e->lock == PORT_LOCKED_OTHER ? "force unlock" : "unlock"),
  422. e->cmd->port_id1,
  423. e->port_no1 + 1, s_port->port[e->port_no1].name
  424. );
  425. break;
  426. case PARSE_ROUTE:
  427. if (e->port_no2 == NO_PORT) {
  428. printf("%sdisconnect %s %d \"%s\"\n",
  429. prefix,
  430. e->cmd->port_id1,
  431. e->port_no1 + 1, s_port->port[e->port_no1].name
  432. );
  433. break;
  434. }
  435. if (e->cmd->allow_disconnect) {
  436. printf("%sconnect %s %d \"%s\" to %s %d \"%s\"\n",
  437. prefix,
  438. e->cmd->port_id1,
  439. e->port_no1 + 1, s_port->port[e->port_no1].name,
  440. e->cmd->port_id2,
  441. e->port_no2 + 1, d_port->port [e->port_no2].name
  442. );
  443. break;
  444. }
  445. printf("%sset %s %d \"%s\" to read from %s %d \"%s\"\n",
  446. prefix,
  447. e->cmd->port_id1,
  448. e->port_no1 + 1, s_port->port[e->port_no1].name,
  449. e->cmd->port_id2,
  450. e->port_no2 + 1, d_port->port [e->port_no2].name
  451. );
  452. break;
  453. case PARSE_DIR:
  454. printf("%sset %s %d \"%s\" direction to %s\n",
  455. prefix,
  456. e->cmd->port_id1,
  457. e->port_no1 + 1, s_port->port[e->port_no1].name,
  458. dir2txt(e->direction)
  459. );
  460. break;
  461. default: break;
  462. }
  463. }