-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathswitch_conf.c
More file actions
34 lines (31 loc) · 837 Bytes
/
switch_conf.c
File metadata and controls
34 lines (31 loc) · 837 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/*
* Copyright (c) 2015-2018 OscillatorIMP Digital
* Gwenhael Goavec-Merou <gwenhael.goavec-merou@trabucayre.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License.
*
*/
#include <stdint.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <getopt.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <linux/types.h>
/* memory management */
#include <sys/mman.h>
#include <switch_core/switch_config.h>
int switch_send_conf(char *filename, int input)
{
int fd_sw = open(filename, O_RDWR);
if (fd_sw < 0) {
printf("erreur d'ouverture de %s\n", filename);
return fd_sw;
}
ioctl(fd_sw, SWITCH_SELECT_INPUT, &input);
close(fd_sw);
return 0;
}