int info_print(int fd, int channel, int prchan) { struct ata_ioc_devices devices; devices.channel = channel; if (ioctl(fd, IOCATADEVICES, &devices) < 0) return errno; if (prchan) printf("ATA channel %d:\n", channel); printf("%sMaster: ", prchan ? " " : ""); if (*devices.name[0]) { printf("%4.4s ", devices.name[0]); param_print(&devices.params[0]); } else printf(" no device present\n"); printf("%sSlave: ", prchan ? " " : ""); if (*devices.name[1]) { printf("%4.4s ", devices.name[1]); param_print(&devices.params[1]); } else printf(" no device present\n"); return 0; }
int info_print(int fd, int channel, int prchan) { struct ata_cmd iocmd; bzero(&iocmd, sizeof(struct ata_cmd)); iocmd.channel = channel; iocmd.device = -1; iocmd.cmd = ATAGPARM; if (ioctl(fd, IOCATA, &iocmd) < 0) return errno; if (prchan) printf("ATA channel %d:\n", channel); printf("%sMaster: ", prchan ? " " : ""); if (iocmd.u.param.type[0]) { printf("%4.4s ", iocmd.u.param.name[0]); param_print(&iocmd.u.param.params[0]); } else printf(" no device present\n"); printf("%sSlave: ", prchan ? " " : ""); if (iocmd.u.param.type[1]) { printf("%4.4s ", iocmd.u.param.name[1]); param_print(&iocmd.u.param.params[1]); } else printf(" no device present\n"); return 0; }
static void print_param(const struct param *param) { char tmp[17]; param_print(menu_cur->param, tmp, sizeof(tmp)); lcd_write(0, 1, tmp, LCD_FILL_BLANK); }