Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[usb_moded] Normalize multiline comments
Just to make it easier for editor to handle automatic indentation, make
all C comment continuation lines start with whitespace followed by '*'.

Signed-off-by: Simo Piiroinen <simo.piiroinen@jollamobile.com>
  • Loading branch information
spiiroin committed Aug 24, 2018
1 parent 154bc19 commit 7a386e3
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 38 deletions.
4 changes: 2 additions & 2 deletions src/usb_moded-appsync-dbus.c
Expand Up @@ -297,8 +297,8 @@ gboolean dbusappsync_init_connection(void)
dbus_connection_set_exit_on_disconnect(dbus_connection_ses, FALSE);

/* Connect D-Bus to the mainloop (Seems it is only needed once and is done at the main
D-Bus init
dbus_connection_setup_with_g_main(dbus_connection_ses, NULL);
* D-Bus init
* dbus_connection_setup_with_g_main(dbus_connection_ses, NULL);
*/

/* Request service name */
Expand Down
6 changes: 3 additions & 3 deletions src/usb_moded-appsync.c
Expand Up @@ -145,7 +145,7 @@ void appsync_read_list(int diag)
if( confdir ) g_dir_close(confdir);

/* sort list alphabetically so services for a mode
can be run in a certain order */
* can be run in a certain order */
sync_list=g_list_sort(sync_list, appsync_list_sort_func);

/* set up session bus connection if app sync in use
Expand Down Expand Up @@ -291,7 +291,7 @@ int appsync_activate_sync(const char *mode)
else if(data->launch)
{
/* skipping if dbus session bus is not available,
or not compiled in */
* or not compiled in */
if(no_dbus)
appsync_mark_active(data->name, 0);
#ifdef APP_SYNC_DBUS
Expand Down Expand Up @@ -352,7 +352,7 @@ int appsync_activate_sync_post(const char *mode)
else if(data->launch)
{
/* skipping if dbus session bus is not available,
or not compiled in */
* or not compiled in */
if(no_dbus)
continue;
#ifdef APP_SYNC_DBUS
Expand Down
18 changes: 9 additions & 9 deletions src/usb_moded-config.c
Expand Up @@ -233,7 +233,7 @@ static void config_create_conf_file(void)
struct stat dir_stat;

/* since this function can also be called when the dir exists we only create
it if it is missing */
* it if it is missing */
if(stat(CONFIG_FILE_DIR, &dir_stat))
{
dir = mkdir(CONFIG_FILE_DIR, 0755);
Expand Down Expand Up @@ -355,7 +355,7 @@ static char * config_get_kcmdline_string(const char *entry)
cmdLine[len] = '\0';

/* we're looking for a piece of the kernel command line matching this:
ip=192.168.3.100::192.168.3.1:255.255.255.0::usb0:on */
* ip=192.168.3.100::192.168.3.1:255.255.255.0::usb0:on */
if (!g_shell_parse_argv(cmdLine, &argc, &argv, &optErr))
{
g_error_free(optErr);
Expand Down Expand Up @@ -451,8 +451,8 @@ set_config_result_t config_set_config_setting(const char *entry, const char *key
g_key_file_set_string(settingsfile, entry, key, value);
keyfile = g_key_file_to_data (settingsfile, NULL, NULL);
/* free the settingsfile before writing things out to be sure
the contents will be correctly written to file afterwards.
Just a precaution. */
* the contents will be correctly written to file afterwards.
* Just a precaution. */
g_key_file_free(settingsfile);
if (g_file_set_contents(FS_MOUNT_CONFIG_FILE, keyfile, -1, NULL))
ret = SET_CONFIG_UPDATED;
Expand All @@ -469,7 +469,7 @@ set_config_result_t config_set_mode_setting(const char *mode)
}

/* Builds the string used for hidden modes, when hide set to one builds the
new string of hidden modes when adding one, otherwise it will remove one */
* new string of hidden modes when adding one, otherwise it will remove one */
static char * config_make_modes_string(const char *key, const char *mode_name, int include)
{
char *modes_new = 0;
Expand Down Expand Up @@ -654,8 +654,8 @@ set_config_result_t config_set_network_setting(const char *config, const char *s
g_key_file_set_string(settingsfile, NETWORK_ENTRY, config, setting);
keyfile = g_key_file_to_data (settingsfile, NULL, NULL);
/* free the settingsfile before writing things out to be sure
the contents will be correctly written to file afterwards.
Just a precaution. */
* the contents will be correctly written to file afterwards.
* Just a precaution. */
g_key_file_free(settingsfile);
if (g_file_set_contents(FS_MOUNT_CONFIG_FILE, keyfile, -1, NULL))
ret = SET_CONFIG_UPDATED;
Expand Down Expand Up @@ -684,13 +684,13 @@ char * config_get_network_setting(const char *config)
{

/* check main configuration before using
the information from the specific mode */
* the information from the specific mode */
ret = config_get_network_interface();

if(ret)
goto end;
/* no interface override specified, let's use the one
from the mode config */
* from the mode config */
data = usbmoded_get_usb_mode_data();
if(data)
{
Expand Down
10 changes: 5 additions & 5 deletions src/usb_moded-modesetting.c
Expand Up @@ -199,7 +199,7 @@ int modesetting_write_to_file_real(const char *file, int line, const char *func,
bool clear = false;

/* if either path or the text to be written are not there
we return an error */
* we return an error */
if(!text || !path)
return err;

Expand Down Expand Up @@ -296,7 +296,7 @@ static int modesetting_set_mass_storage_mode(struct mode_list_elem *data)
if(strcmp(data->mode_module, MODULE_NONE))
{
/* check if the file storage module has been loaded with sufficient luns in the parameter,
if not, unload and reload or load it. Since mountpoints start at 0 the amount of them is one more than their id */
* if not, unload and reload or load it. Since mountpoints start at 0 the amount of them is one more than their id */
sprintf(command2, "/sys/devices/platform/musb_hdrc/gadget/gadget-lun%d/file", (mountpoints - 1) );
if(access(command2, R_OK) == -1)
{
Expand Down Expand Up @@ -586,7 +586,7 @@ int modesetting_set_dynamic_mode(void)
}

/* try a second time to bring up the network if it failed the first time,
this can happen with functionfs based gadgets (which is why we sleep for a bit */
* this can happen with functionfs based gadgets (which is why we sleep for a bit */
if(network != 0 && data->network)
{
log_debug("Retry setting up the network later\n");
Expand All @@ -596,7 +596,7 @@ int modesetting_set_dynamic_mode(void)
}

/* Needs to be called before application post synching so
that the dhcp server has the right config */
* that the dhcp server has the right config */
if(data->nat || data->dhcp_server)
network_set_up_dhcpd(data);

Expand Down Expand Up @@ -703,7 +703,7 @@ int modesetting_cleanup(const char *module)
if(!strcmp(module, MODULE_MASS_STORAGE)|| !strcmp(module, MODULE_FILE_STORAGE))
{
/* no clean-up needs to be done when we come from charging mode. We need
to check since we use fake mass-storage for charging */
* to check since we use fake mass-storage for charging */
if(!strcmp(MODE_CHARGING, usbmoded_get_usb_mode()) || !strcmp(MODE_CHARGING_FALLBACK, usbmoded_get_usb_mode()))
return 0;
modesetting_unset_mass_storage_mode(NULL);
Expand Down
18 changes: 9 additions & 9 deletions src/usb_moded-modules.c
Expand Up @@ -191,12 +191,12 @@ int modules_load_module(const char *module)
if(!strcmp(module, MODULE_CHARGING) || !strcmp(module, MODULE_CHARGE_FALLBACK))
{
/* split the string in module name and argument, they are the same for MODULE_CHARGE_FALLBACK
so no need to handle them separately */
* so no need to handle them separately */
gchar **strings;

/* since the mass_storage module is the newer one and we check against it to avoid
loading failures we use it here, as we fall back to g_file_storage if g_mass_storage
fails to load */
* loading failures we use it here, as we fall back to g_file_storage if g_mass_storage
* fails to load */
strings = g_strsplit(MODULE_CHARGE_FALLBACK, " ", 2);
//log_debug("module args = %s, module = %s\n", strings[1], strings[0]);
charging_args = strdup(strings[1]);
Expand All @@ -208,7 +208,7 @@ int modules_load_module(const char *module)
}
ret = kmod_module_new_from_name(ctx, load, &mod);
/* since kmod_module_new_from_name does not check if the module
exists we test it's path in case we deal with the mass-storage one */
* exists we test it's path in case we deal with the mass-storage one */
if(!strcmp(module, MODULE_MASS_STORAGE) &&
(kmod_module_get_path(mod) == NULL))
{
Expand Down Expand Up @@ -330,21 +330,21 @@ int modules_cleanup_module(const char *module)
}

/* wait a bit for all components listening on dbus to clean up their act
usbmoded_sleep(2); */
* usbmoded_sleep(2); */
/* check if things were not reconnected in that timespan
if(usbmoded_get_connection_state())
return(0);
* if(usbmoded_get_connection_state())
* return(0);
*/

failure = modules_unload_module(module);

/* if we have MODULE_MASS_STORAGE it might be MODULE_FILE_STORAGE might
be loaded. So check and unload that one if unloading fails first time */
* be loaded. So check and unload that one if unloading fails first time */
if(failure && !strcmp(MODULE_MASS_STORAGE, module))
failure = modules_unload_module(MODULE_FILE_STORAGE);

/* if it still failed it might be the mode has not been cleaned-up correctly,
so we clean up the mode to be sure */
* so we clean up the mode to be sure */
if(failure)
{
modesetting_cleanup(modules_get_loaded_module());
Expand Down
2 changes: 1 addition & 1 deletion src/usb_moded-udev.c
Expand Up @@ -461,7 +461,7 @@ static int umudev_score_as_power_supply(const char *syspath)
score = score + 10;

/* type is used to detect if it is a cable or dedicated charger.
Bonus points if it is there. */
* Bonus points if it is there. */
if(udev_device_get_property_value(dev, "POWER_SUPPLY_TYPE"))
score = score + 10;

Expand Down
18 changes: 9 additions & 9 deletions src/usb_moded.c
Expand Up @@ -543,7 +543,7 @@ static void usbmoded_switch_to_mode(const char *mode)
ret = modules_load_module(data->mode_module);

/* set data before calling any of the dynamic mode functions
as they will use the usbmoded_get_usb_mode_data function */
* as they will use the usbmoded_get_usb_mode_data function */
usbmoded_set_usb_mode_data(data);

/* check if modules are ok before continuing */
Expand Down Expand Up @@ -779,8 +779,8 @@ void usbmoded_set_usb_connected_state(void)

if (!strcmp(MODE_ASK, mode_to_set))
{
/*! If charging mode is the only available selection, don't ask
just select it */
/* If charging mode is the only available selection, don't ask
* just select it */
gchar *available_modes = usbmoded_get_mode_list(AVAILABLE_MODES_LIST);
if (!strcmp(MODE_CHARGING, available_modes)) {
gchar *temp = mode_to_set;
Expand All @@ -793,12 +793,12 @@ void usbmoded_set_usb_connected_state(void)
if(!strcmp(MODE_ASK, mode_to_set))
{
/* send signal, mode will be set when the dialog service calls
the set_mode method call.
* the set_mode method call.
*/
umdbus_send_state_signal(USB_CONNECTED_DIALOG_SHOW);

/* in case there was nobody listening for the UI, they will know
that the UI is needed by requesting the current mode */
* that the UI is needed by requesting the current mode */
usbmoded_set_usb_mode(MODE_ASK);
}
else
Expand All @@ -807,8 +807,8 @@ void usbmoded_set_usb_connected_state(void)
else
{
/* config is corrupted or we do not have a mode configured, fallback to charging
We also fall back here in case the device is locked and we do not
export the system contents. Or if we are in acting dead mode.
* We also fall back here in case the device is locked and we do not
* export the system contents. Or if we are in acting dead mode.
*/
usbmoded_set_usb_mode(MODE_CHARGING_FALLBACK);
}
Expand Down Expand Up @@ -872,7 +872,7 @@ void usbmoded_set_usb_connected(bool connected)
void usbmoded_set_charger_connected(bool state)
{
/* check if charger is already connected
to avoid spamming dbus */
* to avoid spamming dbus */
if( !usbmoded_set_connection_state(state) )
goto EXIT;

Expand Down Expand Up @@ -949,7 +949,7 @@ int usbmoded_valid_mode(const char *mode)
{
int valid = 1;
/* MODE_ASK, MODE_CHARGER and MODE_CHARGING_FALLBACK are not modes that are settable seen their special 'internal' status
so we only check the modes that are announed outside. Only exception is the built in MODE_CHARGING */
* so we only check the modes that are announed outside. Only exception is the built in MODE_CHARGING */
if(!strcmp(MODE_CHARGING, mode))
valid = 0;
else
Expand Down

0 comments on commit 7a386e3

Please sign in to comment.