32
#include "resources.h"
30
34
#include "rs232drv.h"
35
#ifdef HAS_TRANSLATION
36
#include "translate.h"
46
/*static*/ char *devfile[NUM_DEVICES] = { NULL, NULL, NULL, NULL };
48
static int set_devfile(resource_value_t v, void *param)
50
util_string_set(&devfile[(int)param], (const char *)v);
54
/* ------------------------------------------------------------------------- */
56
static const resource_t resources[] = {
57
{ "RsDevice1", RES_STRING, (resource_value_t)ARCHDEP_RS232_DEV1,
58
(void *)&devfile[0], set_devfile, (void *)0 },
59
{ "RsDevice2", RES_STRING, (resource_value_t)ARCHDEP_RS232_DEV2,
60
(void *)&devfile[1], set_devfile, (void *)1 },
61
{ "RsDevice3", RES_STRING, (resource_value_t)ARCHDEP_RS232_DEV3,
62
(void *)&devfile[2], set_devfile, (void *)2 },
63
{ "RsDevice4", RES_STRING, (resource_value_t)ARCHDEP_RS232_DEV4,
64
(void *)&devfile[3], set_devfile, (void *)3 },
68
int rs232drv_resources_init(void)
70
if (resources_register(resources) < 0)
73
return rs232_resources_init();
76
void rs232drv_resources_shutdown(void)
83
rs232_resources_shutdown();
86
#ifdef HAS_TRANSLATION
87
static const cmdline_option_t cmdline_options[] = {
88
{ "-rsdev1", SET_RESOURCE, 1, NULL, NULL, "RsDevice1", NULL,
89
IDCLS_P_NAME, IDCLS_SPECIFY_RS232_1_NAME },
90
{ "-rsdev2", SET_RESOURCE, 1, NULL, NULL, "RsDevice2", NULL,
91
IDCLS_P_NAME, IDCLS_SPECIFY_RS232_2_NAME },
92
{ "-rsdev3", SET_RESOURCE, 1, NULL, NULL, "RsDevice3", NULL,
93
IDCLS_P_NAME, IDCLS_SPECIFY_RS232_3_NAME },
94
{ "-rsdev4", SET_RESOURCE, 1, NULL, NULL, "RsDevice4", NULL,
95
IDCLS_P_NAME, IDCLS_SPECIFY_RS232_4_NAME },
99
static const cmdline_option_t cmdline_options[] = {
100
{ "-rsdev1", SET_RESOURCE, 1, NULL, NULL, "RsDevice1", NULL,
101
N_("<name>"), N_("Specify name of first RS232 device") },
102
{ "-rsdev2", SET_RESOURCE, 1, NULL, NULL, "RsDevice2", NULL,
103
N_("<name>"), N_("Specify name of second RS232 device") },
104
{ "-rsdev3", SET_RESOURCE, 1, NULL, NULL, "RsDevice3", NULL,
105
N_("<name>"), N_("Specify name of third RS232 device") },
106
{ "-rsdev4", SET_RESOURCE, 1, NULL, NULL, "RsDevice4", NULL,
107
N_("<name>"), N_("Specify name of fourth RS232 device") },
112
int rs232drv_cmdline_options_init(void)
114
if (cmdline_register_options(cmdline_options) < 0)
117
return rs232_cmdline_options_init();
36
120
void rs232drv_init(void)