static ssize_t dgnc_ports_msignals_show(struct device *p, struct device_attribute *attr, char *buf) { struct board_t *bd; int count = 0; int i = 0; DGNC_VERIFY_BOARD(p, bd); for (i = 0; i < bd->nasync; i++) { if (bd->channels[i]->ch_open_count) { count += snprintf(buf + count, PAGE_SIZE - count, "%d %s %s %s %s %s %s\n", bd->channels[i]->ch_portnum, (bd->channels[i]->ch_mostat & UART_MCR_RTS) ? "RTS" : "", (bd->channels[i]->ch_mistat & UART_MSR_CTS) ? "CTS" : "", (bd->channels[i]->ch_mostat & UART_MCR_DTR) ? "DTR" : "", (bd->channels[i]->ch_mistat & UART_MSR_DSR) ? "DSR" : "", (bd->channels[i]->ch_mistat & UART_MSR_DCD) ? "DCD" : "", (bd->channels[i]->ch_mistat & UART_MSR_RI) ? "RI" : ""); } else { count += snprintf(buf + count, PAGE_SIZE - count, "%d\n", bd->channels[i]->ch_portnum); } } return count; }
static ssize_t dgnc_ports_txcount_show(struct device *p, struct device_attribute *attr, char *buf) { struct board_t *bd; int count = 0; int i = 0; DGNC_VERIFY_BOARD(p, bd); for (i = 0; i < bd->nasync; i++) { count += snprintf(buf + count, PAGE_SIZE - count, "%d %ld\n", bd->channels[i]->ch_portnum, bd->channels[i]->ch_txcount); } return count; }
static ssize_t dgnc_serial_number_show(struct device *p, struct device_attribute *attr, char *buf) { struct board_t *bd; int count = 0; DGNC_VERIFY_BOARD(p, bd); if (bd->serial_num[0] == '\0') count += sprintf(buf + count, "<UNKNOWN>\n"); else count += sprintf(buf + count, "%s\n", bd->serial_num); return count; }
static ssize_t dgnc_ports_state_show(struct device *p, struct device_attribute *attr, char *buf) { struct dgnc_board *bd; int count = 0; int i = 0; DGNC_VERIFY_BOARD(p, bd); for (i = 0; i < bd->nasync; i++) { count += snprintf(buf + count, PAGE_SIZE - count, "%d %s\n", bd->channels[i]->ch_portnum, bd->channels[i]->ch_open_count ? "Open" : "Closed"); } return count; }
static ssize_t dgnc_vpd_show(struct device *p, struct device_attribute *attr, char *buf) { struct board_t *bd; int count = 0; int i = 0; DGNC_VERIFY_BOARD(p, bd); count += sprintf(buf + count, "\n 0 1 2 3 4 5 6 7 8 9 A B C D E F"); for (i = 0; i < 0x40 * 2; i++) { if (!(i % 16)) count += sprintf(buf + count, "\n%04X ", i * 2); count += sprintf(buf + count, "%02X ", bd->vpd[i]); } count += sprintf(buf + count, "\n"); return count; }