1#![no_std]
4
5extern crate alloc;
6
7mod host;
8mod node;
9
10pub use bt_hci as hci;
11pub use device::bluetooth::*;
12pub use host::Controller;
13pub use node::BluetoothDevice;
14
15use file_system::{IoErrorKind, Path, Permissions, Result};
16use task::TaskIdentifier;
17use virtual_file_system::{ItemStatic, VirtualFileSystem};
18
19pub const DEVICE_PATH: &str = "/devices/bluetooth/hci0";
20
21pub async fn mount(
24 file_system: &VirtualFileSystem,
25 task: TaskIdentifier,
26 device: &'static BluetoothDevice,
27) -> Result<()> {
28 match file_system
29 .create_directory(task, &Path::BLUETOOTH_DEVICES)
30 .await
31 {
32 Ok(()) | Err(IoErrorKind::AlreadyExists) => {}
33 Err(error) => return Err(error),
34 }
35
36 file_system
37 .mount_static_with_permissions(
38 task,
39 DEVICE_PATH,
40 ItemStatic::CharacterDevice(device),
41 Permissions::USER_READ_WRITE,
42 )
43 .await
44}