usb_moded  0.86.0+mer57
Macros | Functions
usb_moded.h File Reference
#include "../config.h"
#include "usb_moded-dyn-config.h"

Go to the source code of this file.

Macros

#define USB_MODED_WAKELOCK_STATE_CHANGE   "usb_moded_state"
 
#define USB_MODED_WAKELOCK_PROCESS_INPUT   "usb_moded_input"
 
#define USB_MODED_SUSPEND_DELAY_DEFAULT_MS   5000
 
#define USB_MODED_SUSPEND_DELAY_MAXIMUM_MS   (USB_MODED_SUSPEND_DELAY_DEFAULT_MS * 2)
 

Functions

GList * usbmoded_get_modelist (void)
 
void usbmoded_load_modelist (void)
 
void usbmoded_free_modelist (void)
 
const modedata_tusbmoded_get_modedata (const char *modename)
 
modedata_tusbmoded_dup_modedata (const char *modename)
 
void usbmoded_set_cable_connection_delay (int delay_ms)
 
int usbmoded_get_cable_connection_delay (void)
 
void usbmoded_allow_suspend (void)
 
void usbmoded_delay_suspend (void)
 
bool usbmoded_in_usermode (void)
 
bool usbmoded_in_shutdown (void)
 
uid_t usbmoded_get_current_user (void)
 
bool usbmoded_can_export (void)
 
bool usbmoded_init_done_p (void)
 
void usbmoded_set_init_done (bool reached)
 
void usbmoded_probe_init_done (void)
 
void usbmoded_exit_mainloop (int exitcode)
 

Detailed Description

Copyright (c) 2010 Nokia Corporation. All rights reserved. Copyright (c) 2012 - 2021 Jolla Ltd. Copyright (c) 2020 Open Mobile Platform LLC.

Author
Philippe De Swert phili.nosp@m.ppe..nosp@m.de-sw.nosp@m.ert@.nosp@m.nokia.nosp@m..com
Philippe De Swert phili.nosp@m.pped.nosp@m.eswer.nosp@m.t@gm.nosp@m.ail.c.nosp@m.om
Philippe De Swert phili.nosp@m.ppe..nosp@m.deswe.nosp@m.rt@j.nosp@m.ollam.nosp@m.obil.nosp@m.e.com
Simo Piiroinen simo..nosp@m.piir.nosp@m.oinen.nosp@m.@jol.nosp@m.lamob.nosp@m.ile..nosp@m.com
Andrew den Exter andre.nosp@m.w.de.nosp@m.n.ext.nosp@m.er@j.nosp@m.olla..nosp@m.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

Definition in file usb_moded.h.

Macro Definition Documentation

◆ USB_MODED_SUSPEND_DELAY_DEFAULT_MS

#define USB_MODED_SUSPEND_DELAY_DEFAULT_MS   5000

How long usb_moded will delay suspend by default [ms]

Definition at line 53 of file usb_moded.h.

◆ USB_MODED_SUSPEND_DELAY_MAXIMUM_MS

#define USB_MODED_SUSPEND_DELAY_MAXIMUM_MS   (USB_MODED_SUSPEND_DELAY_DEFAULT_MS * 2)

How long usb_moded is allowed to block suspend [ms]

Definition at line 56 of file usb_moded.h.

◆ USB_MODED_WAKELOCK_PROCESS_INPUT

#define USB_MODED_WAKELOCK_PROCESS_INPUT   "usb_moded_input"

Name of the wakelock usb_moded uses for input processing

Definition at line 50 of file usb_moded.h.

◆ USB_MODED_WAKELOCK_STATE_CHANGE

#define USB_MODED_WAKELOCK_STATE_CHANGE   "usb_moded_state"

Name of the wakelock usb_moded uses for temporary suspend delay

Definition at line 47 of file usb_moded.h.

Function Documentation

◆ usbmoded_allow_suspend()

void usbmoded_allow_suspend ( void  )

Release wakelock acquired via usbmoded_delay_suspend()

Meant to be called on usb-moded exit so that wakelocks are not left behind.

Definition at line 481 of file usb_moded.c.

◆ usbmoded_can_export()

bool usbmoded_can_export ( void  )

Check if exposing device data is currently allowed

Returns
true exposing data is ok, or false otherwise

Definition at line 591 of file usb_moded.c.

◆ usbmoded_delay_suspend()

void usbmoded_delay_suspend ( void  )

Block suspend briefly

Meant to be called in situations usb activity might have woken up the device (cable connect while display is off), or could allow device to suspend (cable disconnect while display is off).

Allows usb moded some time to finish asynchronous activity and other processes to receive and process state changes broadcast by usb-moded.

Definition at line 506 of file usb_moded.c.

◆ usbmoded_dup_modedata()

modedata_t* usbmoded_dup_modedata ( const char *  modename)

Lookup and clone dynamic mode data by name

Note: This function is safe to call from worker thread too.

Caller must release the returned object via modedata_free().

Parameters
modenameName of mode to lookup
Returns
Mode data object, or NULL

Definition at line 279 of file usb_moded.c.

◆ usbmoded_exit_mainloop()

void usbmoded_exit_mainloop ( int  exitcode)

Request orderly exit from mainloop

Definition at line 664 of file usb_moded.c.

◆ usbmoded_free_modelist()

void usbmoded_free_modelist ( void  )

Free dynamic mode data items

Note: This function should be called only from the main thread.

Definition at line 228 of file usb_moded.c.

◆ usbmoded_get_cable_connection_delay()

int usbmoded_get_cable_connection_delay ( void  )

Helper for getting allowed cable detection delay

Definition at line 442 of file usb_moded.c.

◆ usbmoded_get_current_user()

uid_t usbmoded_get_current_user ( void  )

Return current user id

If MEEGOLOCK and SAILFISH_ACCESS_CONTROL are selected, returns uid of user session at seat0 / UID_UNKNOWN.

Otherwise always returns 0 (root user).

Definition at line 572 of file usb_moded.c.

◆ usbmoded_get_modedata()

const modedata_t* usbmoded_get_modedata ( const char *  modename)

Lookup dynamic mode data by name

Note: This function should be called only from the main thread.

Parameters
modenameName of mode to lookup
Returns
Mode data object, or NULL

Definition at line 252 of file usb_moded.c.

◆ usbmoded_get_modelist()

GList* usbmoded_get_modelist ( void  )

Get list of dynamic mode data items

Note: This function should be called only from the main thread.

Returns
List of mode data objects, or NULL

Definition at line 197 of file usb_moded.c.

◆ usbmoded_in_shutdown()

bool usbmoded_in_shutdown ( void  )

Checks if the device is shutting down

Returns
true if device is in SHUTDOWN or REBOOT state, false otherwise

Definition at line 549 of file usb_moded.c.

◆ usbmoded_in_usermode()

bool usbmoded_in_usermode ( void  )

Checks if the device is in USER state

Returns
true if device is in USER state, false otherwise

Definition at line 533 of file usb_moded.c.

◆ usbmoded_init_done_p()

bool usbmoded_init_done_p ( void  )

Check if system has already been successfully booted up

Returns
true if init-done has been reached, or false otherwise

Definition at line 625 of file usb_moded.c.

◆ usbmoded_load_modelist()

void usbmoded_load_modelist ( void  )

Load dynamic mode data items

Note: This function should be called only from the main thread.

Definition at line 209 of file usb_moded.c.

◆ usbmoded_probe_init_done()

void usbmoded_probe_init_done ( void  )

Check whether init-done flag file exists

Definition at line 651 of file usb_moded.c.

◆ usbmoded_set_cable_connection_delay()

void usbmoded_set_cable_connection_delay ( int  delay_ms)

Helper for setting allowed cable detection delay

Used for implementing –max-cable-delay=delay_ms option.

Definition at line 422 of file usb_moded.c.

◆ usbmoded_set_init_done()

void usbmoded_set_init_done ( bool  reached)

Update cached init-done-reached state

Definition at line 633 of file usb_moded.c.