Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
settingsd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
settingsd
Commits
1aca020d
Commit
1aca020d
authored
Nov 15, 2010
by
Devaev Maxim
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Using constructor instead initService(), first run not emits signals
parent
b2babf58
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
11 deletions
+20
-11
fmod_disks_smart.py
plugins/functions/fmod_disks_smart.py
+20
-11
No files found.
plugins/functions/fmod_disks_smart.py
View file @
1aca020d
...
...
@@ -97,31 +97,40 @@ class DisksSmart(service.FunctionObject) :
##### Public classes #####
class
Service
(
service
.
Service
)
:
def
initService
(
self
)
:
s
hared
.
Functions
.
addShared
(
DISKS_SMART_SHARED_NAME
)
def
__init__
(
self
)
:
s
ervice
.
Service
.
__init__
(
self
)
###
###
##
self
.
__disks_smart
=
DisksSmart
(
DISKS_SMART_SHARED_NAME
,
self
)
shared
.
Functions
.
addSharedObject
(
DISKS_SMART_OBJECT_NAME
,
self
.
__disks_smart
)
self
.
__udev_client
=
gudev
.
Client
([
"block"
])
###
self
.
__disks_smart
=
DisksSmart
(
DISKS_SMART_OBJECT_NAME
,
self
)
self
.
__udev_client
=
gudev
.
Client
([
"block"
])
### Public ###
def
initService
(
self
)
:
shared
.
Functions
.
addShared
(
DISKS_SMART_SHARED_NAME
)
shared
.
Functions
.
addSharedObject
(
DISKS_SMART_SHARED_NAME
,
self
.
__disks_smart
)
logger
.
verbose
(
"{mod}: First devices request..."
)
disks_smart_shared
=
shared
.
Functions
.
shared
(
DISKS_SMART_SHARED_NAME
)
disks_filter_regexp
=
re
.
compile
(
config
.
value
(
SERVICE_NAME
,
"disks_filter"
))
devices_count
=
0
for
device
in
self
.
__udev_client
.
query_by_subsystem
(
"block"
)
:
if
disks_filter_regexp
.
match
(
device
.
get_name
())
:
self
.
udevEvent
(
self
.
__udev_client
,
"add"
,
device
)
device_name
=
device
.
get_name
()
if
disks_filter_regexp
.
match
(
device_name
)
:
disks_smart_shared
.
addSharedObject
(
device_name
,
Disk
(
device
.
get_device_file
(),
dbus_tools
.
joinPath
(
DISKS_SMART_SHARED_NAME
,
device_name
),
self
))
devices_count
+=
1
logger
.
verbose
(
"{mod}: Added
%
d devices"
%
(
devices_count
))
self
.
__udev_client
.
connect
(
"uevent"
,
self
.
udevEvent
)
logger
.
verbose
(
"{mod}: Start polling udev events"
)
logger
.
verbose
(
"{mod}: Start polling udev events
for
\"
block
\"
"
)
def
closeService
(
self
)
:
self
.
__udev_client
.
disconnect_by_func
(
self
.
udevEvent
)
logger
.
verbose
(
"{mod}: Stop polling udev events"
)
logger
.
verbose
(
"{mod}: Stop polling udev events
for
\"
block
\"
"
)
###
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment