Skip to content

Latest commit

 

History

History
142 lines (121 loc) · 6.78 KB

usb_moded-dyn-config.h

File metadata and controls

142 lines (121 loc) · 6.78 KB
 
May 10, 2011
May 10, 2011
1
/*
Aug 24, 2018
Aug 24, 2018
2
3
*
* Copyright (C) 2011 Nokia Corporation. All rights reserved.
Apr 9, 2019
Apr 9, 2019
4
* Copyright (C) 2013-2019 Jolla Ltd.
Aug 24, 2018
Aug 24, 2018
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
*
* author: Philippe De Swert <philippe.de-swert@nokia.com>
* author: Philippe De Swert <phdeswer@lumi.maa>
* author: Philippe De Swert <philippedeswert@gmail.com>
* author: Philippe De Swert <philippe.deswert@jollamobile.com>
* author: Thomas Perl <m@thp.io>
* author: Slava Monich <slava.monich@jolla.com>
* author: Simo Piiroinen <simo.piiroinen@jollamobile.com>
* author: Andrew den Exter <andrew.den.exter@jolla.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the Lesser GNU General Public License
* version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the Lesser GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA
*/
May 10, 2011
May 10, 2011
29
Aug 24, 2018
Aug 24, 2018
30
31
#ifndef USB_MODED_DYN_CONFIG_H_
# define USB_MODED_DYN_CONFIG_H_
May 10, 2011
May 10, 2011
32
Apr 9, 2019
Apr 9, 2019
33
# include <stdbool.h>
Sep 5, 2018
Sep 5, 2018
34
35
# include <glib.h>
Aug 24, 2018
Aug 24, 2018
36
37
38
/* ========================================================================= *
* Constants
* ========================================================================= */
May 10, 2011
May 10, 2011
39
Aug 24, 2018
Aug 24, 2018
40
41
# define MODE_DIR_PATH "/etc/usb-moded/dyn-modes"
# define DIAG_DIR_PATH "/etc/usb-moded/diag"
May 10, 2011
May 10, 2011
42
Aug 24, 2018
Aug 24, 2018
43
44
45
46
/* - - - - - - - - - - - - - - - - - - - *
* [mode] ini-file block
* - - - - - - - - - - - - - - - - - - - */
Aug 24, 2018
Aug 24, 2018
47
48
49
# define MODE_ENTRY "mode"
# define MODE_NAME_KEY "name"
# define MODE_MODULE_KEY "module"
Aug 24, 2018
Aug 24, 2018
50
51
52
# define MODE_NEEDS_APPSYNC_KEY "appsync" // integer
# define MODE_NETWORK_KEY "network" // integer
# define MODE_MASS_STORAGE_KEY "mass_storage" // integer
Aug 24, 2018
Aug 24, 2018
53
# define MODE_NETWORK_INTERFACE_KEY "network_interface"
Aug 24, 2018
Aug 24, 2018
54
55
56
57
58
/* - - - - - - - - - - - - - - - - - - - *
* [options] ini-file block
* - - - - - - - - - - - - - - - - - - - */
Aug 24, 2018
Aug 24, 2018
59
60
# define MODE_OPTIONS_ENTRY "options"
# define MODE_SYSFS_PATH "sysfs_path"
Aug 24, 2018
Aug 24, 2018
61
62
63
/* This is list of gadget functions, except for
* host-mode config ... */
Aug 24, 2018
Aug 24, 2018
64
65
# define MODE_SYSFS_VALUE "sysfs_value"
# define MODE_SYSFS_RESET_VALUE "sysfs_reset_value"
Aug 24, 2018
Aug 24, 2018
66
Aug 24, 2018
Aug 24, 2018
67
68
69
70
/* Instead of hard-coding values that never change or have only one option,
android engineers prefered to have sysfs entries... go figure... */
# define MODE_ANDROID_EXTRA_SYSFS_PATH "android_extra_sysfs_path"
# define MODE_ANDROID_EXTRA_SYSFS_VALUE "android_extra_sysfs_value"
Aug 24, 2018
Aug 24, 2018
71
Aug 21, 2013
Aug 21, 2013
72
/* in combined android gadgets we sometime need more than one extra sysfs path or value */
Aug 24, 2018
Aug 24, 2018
73
74
75
76
77
78
# define MODE_ANDROID_EXTRA_SYSFS_PATH2 "android_extra_sysfs_path2"
# define MODE_ANDROID_EXTRA_SYSFS_VALUE2 "android_extra_sysfs_value2"
# define MODE_ANDROID_EXTRA_SYSFS_PATH3 "android_extra_sysfs_path3"
# define MODE_ANDROID_EXTRA_SYSFS_VALUE3 "android_extra_sysfs_value3"
# define MODE_ANDROID_EXTRA_SYSFS_PATH4 "android_extra_sysfs_path4"
# define MODE_ANDROID_EXTRA_SYSFS_VALUE4 "android_extra_sysfs_value4"
Aug 24, 2018
Aug 24, 2018
79
Aug 23, 2013
Aug 23, 2013
80
/* For windows different modes/usb profiles need their own idProduct */
Aug 24, 2018
Aug 24, 2018
81
82
# define MODE_IDPRODUCT "idProduct"
# define MODE_IDVENDOROVERRIDE "idVendorOverride"
Aug 24, 2018
Aug 24, 2018
83
84
# define MODE_HAS_NAT "nat" // integer
# define MODE_HAS_DHCP_SERVER "dhcp_server" // integer
Aug 24, 2018
Aug 24, 2018
85
Aug 24, 2018
Aug 24, 2018
86
87
88
89
90
91
92
# ifdef CONNMAN
# define MODE_CONNMAN_TETHERING "connman_tethering"
# endif
/* ========================================================================= *
* Types
* ========================================================================= */
May 10, 2011
May 10, 2011
93
94
95
96
/**
* Struct keeping all the data needed for the definition of a dynamic mode
*/
Apr 9, 2019
Apr 9, 2019
97
typedef struct modedata_t
May 10, 2011
May 10, 2011
98
{
Apr 9, 2019
Apr 9, 2019
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
gchar *mode_name; /**< Mode name */
gchar *mode_module; /**< Needed module for given mode */
int appsync; /**< Requires appsync or not */
int network; /**< Bring up network or not */
int mass_storage; /**< Use mass-storage functions */
gchar *network_interface; /**< Which network interface to bring up if network needs to be enabled */
gchar *sysfs_path; /**< Path to set sysfs options */
gchar *sysfs_value; /**< Option name/value to write to sysfs */
gchar *sysfs_reset_value; /**< Value to reset the the sysfs to default */
gchar *android_extra_sysfs_path; /**< Path for static value that never changes that needs to be set by sysfs :( */
gchar *android_extra_sysfs_value; /**< Static value that never changes that needs to be set by sysfs :( */
gchar *android_extra_sysfs_path2; /**< Path for static value that never changes that needs to be set by sysfs :( */
gchar *android_extra_sysfs_value2; /**< Static value that never changes that needs to be set by sysfs :( */
gchar *android_extra_sysfs_path3; /**< Path for static value that never changes that needs to be set by sysfs :( */
gchar *android_extra_sysfs_value3; /**< Static value that never changes that needs to be set by sysfs :( */
gchar *android_extra_sysfs_path4; /**< Path for static value that never changes that needs to be set by sysfs :( */
gchar *android_extra_sysfs_value4; /**< Static value that never changes that needs to be set by sysfs :( */
gchar *idProduct; /**< Product id to assign to a specific profile */
gchar *idVendorOverride; /**< Temporary vendor override for special modes used by odms in testing/manufacturing */
int nat; /**< If NAT should be set up in this mode or not */
int dhcp_server; /**< if a DHCP server needs to be configured and started or not */
Aug 24, 2018
Aug 24, 2018
120
# ifdef CONNMAN
Apr 9, 2019
Apr 9, 2019
121
gchar *connman_tethering; /**< Connman's tethering technology path */
Aug 24, 2018
Aug 24, 2018
122
# endif
Apr 9, 2019
Apr 9, 2019
123
} modedata_t;
May 10, 2011
May 10, 2011
124
Aug 24, 2018
Aug 24, 2018
125
126
127
128
/* ========================================================================= *
* Prototypes
* ========================================================================= */
Apr 9, 2019
Apr 9, 2019
129
/* ------------------------------------------------------------------------- *
Apr 9, 2019
Apr 9, 2019
130
* MODEDATA
Apr 9, 2019
Apr 9, 2019
131
* ------------------------------------------------------------------------- */
Oct 22, 2013
Oct 22, 2013
132
Apr 9, 2019
Apr 9, 2019
133
void modedata_free(modedata_t *self);
Apr 9, 2019
Apr 9, 2019
134
135
136
137
138
139
/* ------------------------------------------------------------------------- *
* MODELIST
* ------------------------------------------------------------------------- */
void modelist_free(GList *modelist);
Apr 9, 2019
Apr 9, 2019
140
GList *modelist_load(bool diag);
May 10, 2011
May 10, 2011
141
142
#endif /* USB_MODED_DYN_CONFIG_H_ */