Remove device names from LPT table

This commit is contained in:
RichardG867
2021-07-08 22:55:56 -03:00
parent f88650eea5
commit c39587cfab
5 changed files with 27 additions and 30 deletions

View File

@@ -17,33 +17,31 @@
lpt_port_t lpt_ports[3]; lpt_port_t lpt_ports[3];
static const struct static const struct {
{ const char *internal_name;
const char *name; const lpt_device_t *device;
const char *internal_name; } lpt_devices[] = {
const lpt_device_t *device; {"none", NULL},
} lpt_devices[] = {"dss", &dss_device},
{ {"lpt_dac", &lpt_dac_device},
{"None", "none", NULL}, {"lpt_dac_stereo", &lpt_dac_stereo_device},
{"Disney Sound Source", "dss", &dss_device}, {"text_prt", &lpt_prt_text_device},
{"LPT DAC / Covox Speech Thing", "lpt_dac", &lpt_dac_device}, {"dot_matrix", &lpt_prt_escp_device},
{"Stereo LPT DAC", "lpt_dac_stereo", &lpt_dac_stereo_device}, {"postscript", &lpt_prt_ps_device},
{"Generic Text Printer", "text_prt", &lpt_prt_text_device}, {"plip", &lpt_plip_device},
{"Generic ESC/P Dot-Matrix", "dot_matrix", &lpt_prt_escp_device}, {"dongle_savquest", &lpt_hasp_savquest_device},
{"Generic PostScript Printer", "postscript", &lpt_prt_ps_device}, {"", NULL}
{"PLIP Network", "plip", &lpt_plip_device},
{"Protection Dongle for Savage Quest","dongle_savquest",&lpt_hasp_savquest_device},
{"", "", NULL}
}; };
char * char *
lpt_device_get_name(int id) lpt_device_get_name(int id)
{ {
if (strlen((char *) lpt_devices[id].name) == 0) if (strlen((char *) lpt_devices[id].internal_name) == 0)
return NULL; return NULL;
if (!lpt_devices[id].device)
return (char *) lpt_devices[id].name; return "None";
return (char *) lpt_devices[id].device->name;
} }

View File

@@ -492,7 +492,7 @@ plip_close(void *priv)
const lpt_device_t lpt_plip_device = { const lpt_device_t lpt_plip_device = {
.name = "Parallel Line Internet Protocol (LPT)", .name = "Parallel Line Internet Protocol",
.init = plip_lpt_init, .init = plip_lpt_init,
.close = plip_close, .close = plip_close,
.write_data = plip_write_data, .write_data = plip_write_data,
@@ -502,10 +502,9 @@ const lpt_device_t lpt_plip_device = {
.read_ctrl = NULL .read_ctrl = NULL
}; };
const device_t plip_device = const device_t plip_device = {
{ "Parallel Line Internet Protocol",
"Parallel Line Internet Protocol", DEVICE_LPT, 0,
DEVICE_LPT, 0, plip_net_init, NULL,
plip_net_init, NULL, NULL, { NULL }, NULL, NULL
NULL, { NULL }, NULL, NULL
}; };

View File

@@ -2143,7 +2143,7 @@ escp_close(void *priv)
const lpt_device_t lpt_prt_escp_device = { const lpt_device_t lpt_prt_escp_device = {
"EPSON ESC/P compatible printer", "Generic ESC/P Dot-Matrix",
escp_init, escp_init,
escp_close, escp_close,
write_data, write_data,

View File

@@ -389,7 +389,7 @@ ps_close(void *p)
const lpt_device_t lpt_prt_ps_device = { const lpt_device_t lpt_prt_ps_device = {
.name = "Generic PostScript printer", .name = "Generic PostScript Printer",
.init = ps_init, .init = ps_init,
.close = ps_close, .close = ps_close,
.write_data = ps_write_data, .write_data = ps_write_data,

View File

@@ -483,7 +483,7 @@ prnt_close(void *priv)
const lpt_device_t lpt_prt_text_device = { const lpt_device_t lpt_prt_text_device = {
"Generic TEXT printer", "Generic Text Printer",
prnt_init, prnt_init,
prnt_close, prnt_close,
write_data, write_data,