diff options
author | Pablo Neira Ayuso <pablo@gnumonks.org> | 2011-08-19 18:43:38 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@gnumonks.org> | 2011-08-19 18:43:38 +0200 |
commit | 4e862cbf4b3b438a07ea89438f4384bd10468ea9 (patch) | |
tree | 9e9cc25a91a7b1095566f6375deb3fc449cdc522 /src/input/rs232.c | |
parent | 7e0d006e3c7f163cf1e3621d77a7366a5a7e828a (diff) |
e1_input: rework configuration of virtual E1 line operations
struct e1inp_line_ops {
- enum e1inp_line_role role;
- char *addr;
- void *data;
+ union {
+ struct {
+ enum e1inp_line_role role; /* BSC or BTS mode. */
+ const char *addr; /* IP address .*/
+ void *dev; /* device parameters. */
+ } ipa;
+ struct {
+ const char *port; /* e.g. /dev/ttyUSB0 */
+ unsigned int delay;
+ } rs232;
+ } cfg;
Now this structure contains the configuration details for the
virtual E1 line, instead of using a pointer.
This also get the line_update callback to its original layout:
+ int (*line_update)(struct e1inp_line *line);
Diffstat (limited to 'src/input/rs232.c')
-rw-r--r-- | src/input/rs232.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/input/rs232.c b/src/input/rs232.c index eb6b5d08..2fd2a09b 100644 --- a/src/input/rs232.c +++ b/src/input/rs232.c @@ -277,8 +277,7 @@ rs232_setup(struct e1inp_line *line, const char *serial_port, unsigned int delay return 0; } -static int rs232_line_update(struct e1inp_line *line, - enum e1inp_line_role role, const char *addr); +static int rs232_line_update(struct e1inp_line *line); static struct e1inp_driver rs232_driver = { .name = "rs232", @@ -286,13 +285,13 @@ static struct e1inp_driver rs232_driver = { .line_update = rs232_line_update, }; -static int rs232_line_update(struct e1inp_line *line, - enum e1inp_line_role role, const char *addr) +static int rs232_line_update(struct e1inp_line *line) { if (line->driver != &rs232_driver) return -EINVAL; - return rs232_setup(line, addr, 0); + return rs232_setup(line, line->ops->cfg.rs232.port, + line->ops->cfg.rs232.delay); } int e1inp_rs232_init(void) |