Development over
This commit is contained in:
@@ -2,14 +2,19 @@
|
||||
//!
|
||||
//! Main daemon process for face authentication. Handles camera capture,
|
||||
//! face detection, anti-spoofing checks, and template matching.
|
||||
//!
|
||||
//! The daemon provides two communication interfaces:
|
||||
//! - IPC (Unix socket): For PAM module authentication
|
||||
//! - D-Bus: For desktop applications and system integration
|
||||
|
||||
mod camera;
|
||||
mod detection;
|
||||
|
||||
use linux_hello_common::{Config, Result, TemplateStore};
|
||||
use linux_hello_daemon::auth::AuthService;
|
||||
use linux_hello_daemon::dbus_server::{DbusServer, check_system_bus_available};
|
||||
use linux_hello_daemon::ipc::IpcServer;
|
||||
use tracing::{error, info, Level};
|
||||
use tracing::{error, info, warn, Level};
|
||||
use tracing_subscriber::FmtSubscriber;
|
||||
|
||||
#[tokio::main]
|
||||
@@ -40,7 +45,7 @@ async fn main() -> Result<()> {
|
||||
}
|
||||
}
|
||||
Err(e) => {
|
||||
tracing::warn!("Camera enumeration failed: {}", e);
|
||||
warn!("Camera enumeration failed: {}", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -61,7 +66,7 @@ async fn main() -> Result<()> {
|
||||
|
||||
// Start IPC server
|
||||
let mut ipc_server = IpcServer::new(IpcServer::default_socket_path());
|
||||
|
||||
|
||||
// Set authentication handler
|
||||
let auth_service_for_auth = auth_service.clone();
|
||||
ipc_server.set_auth_handler(move |user| {
|
||||
@@ -102,13 +107,40 @@ async fn main() -> Result<()> {
|
||||
}
|
||||
});
|
||||
|
||||
// Initialize D-Bus server (optional - will fail gracefully if system bus unavailable)
|
||||
let dbus_enabled = check_system_bus_available().await;
|
||||
let mut dbus_server = DbusServer::new();
|
||||
|
||||
if dbus_enabled {
|
||||
match dbus_server.start(auth_service.clone(), config.clone()).await {
|
||||
Ok(()) => {
|
||||
info!("D-Bus server started successfully");
|
||||
info!(" Service: org.linuxhello.Daemon");
|
||||
info!(" Object path: /org/linuxhello/Manager");
|
||||
}
|
||||
Err(e) => {
|
||||
warn!("Failed to start D-Bus server: {}", e);
|
||||
warn!("D-Bus interface will not be available");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
info!("System D-Bus not available, skipping D-Bus server");
|
||||
}
|
||||
|
||||
info!("Linux Hello Daemon ready");
|
||||
info!("Listening for authentication requests...");
|
||||
if dbus_enabled && dbus_server.is_connected() {
|
||||
info!(" - IPC: {}", IpcServer::default_socket_path().display());
|
||||
info!(" - D-Bus: org.linuxhello.Daemon");
|
||||
} else {
|
||||
info!(" - IPC: {}", IpcServer::default_socket_path().display());
|
||||
}
|
||||
|
||||
// Start IPC server in background
|
||||
// Start IPC server as a task
|
||||
let ipc_future = ipc_server.start();
|
||||
|
||||
// Wait for shutdown signal
|
||||
|
||||
// Wait for shutdown signal or server error
|
||||
// Both IPC and D-Bus run concurrently using tokio
|
||||
tokio::select! {
|
||||
_ = tokio::signal::ctrl_c() => {
|
||||
info!("Shutdown signal received");
|
||||
|
||||
Reference in New Issue
Block a user