summaryrefslogtreecommitdiff
path: root/src/core/udev.h
blob: 49c6854b1840b13c8bbb491187fa36f8be4f5169 (plain)
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/*
 * deviced
 *
 * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd.
 *
 * Licensed under the Apache License, Version 2.0 (the License);
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */


#ifndef __UDEV_H__
#define __UDEV_H__

#include <libudev.h>

#define UDEV_CHANGE		"change"
#define UDEV_ADD		"add"
#define UDEV_REMOVE		"remove"

#define UDEV_DEVPATH		"DEVPATH"
#define UDEV_DEVTYPE		"DEVTYPE"

/* battery device */
#define POWER_SUBSYSTEM		"power_supply"
#define POWER_PATH			"/sys/class/power_supply/battery"
#define POWER_SUPPLY_UEVENT POWER_PATH"/uevent"
#define CAPACITY			"POWER_SUPPLY_CAPACITY"
#define CHARGE_FULL			"POWER_SUPPLY_CHARGE_FULL"
#define CHARGE_NOW			"POWER_SUPPLY_CHARGE_NOW"
#define CHARGE_HEALTH		"POWER_SUPPLY_HEALTH"
#define CHARGE_PRESENT		"POWER_SUPPLY_PRESENT"
#define CHARGE_NAME			"POWER_SUPPLY_NAME"
#define CHARGE_STATUS		"POWER_SUPPLY_STATUS"
#define CHARGE_ONLINE		"POWER_SUPPLY_ONLINE"

/* extcon */
#define EXTCON_SUBSYSTEM	"extcon"

/* usb */
#define USB_SUBSYSTEM           "usb"
#define USB_INTERFACE_DEVTYPE   "usb_interface"

/* block */
#define BLOCK_SUBSYSTEM         "block"

/* power supply status */
enum {
	POWER_SUPPLY_STATUS_UNKNOWN = 0,
	POWER_SUPPLY_STATUS_CHARGING,
	POWER_SUPPLY_STATUS_DISCHARGING,
	POWER_SUPPLY_STATUS_NOT_CHARGING,
	POWER_SUPPLY_STATUS_FULL,
};

enum {
	 POWER_SUPPLY_TYPE_UNKNOWN = 0,
	 POWER_SUPPLY_TYPE_BATTERY,
	 POWER_SUPPLY_TYPE_UPS,
	 POWER_SUPPLY_TYPE_MAINS,
	 POWER_SUPPLY_TYPE_USB,
};

enum dock_type {
	DOCK_NONE   = 0,
	DOCK_SOUND  = 7,
};

struct uevent_handler {
	char *subsystem;
	void (*uevent_func)(struct udev_device *dev);
	void *data;
};

int register_kernel_uevent_control(const struct uevent_handler *uh);
int unregister_kernel_uevent_control(const struct uevent_handler *uh);

int register_udev_uevent_control(const struct uevent_handler *uh);
int unregister_udev_uevent_control(const struct uevent_handler *uh);

#endif /* __UDEV_H__ */