Loading build.py +9 −0 Original line number Diff line number Diff line Loading @@ -76,6 +76,7 @@ VALID_TARGETS = [ 'prepare', # Prepare the output directory (gn gen + rust setup) 'rust', # Build only the rust components + copy artifacts to output dir 'test', # Run the unit tests 'clippy', # Run cargo clippy 'utils', # Build Floss utils ] Loading Loading @@ -494,6 +495,12 @@ class HostBuild(): cwd=os.path.join(self.output_dir), env=self.env) def _target_clippy(self): """ Runs cargo clippy, a collection of lints to catch common mistakes. """ cmd = ['cargo', 'clippy'] self.run_command('rust', cmd, cwd=os.path.join(self.platform_dir, 'bt'), env=self.env) def _target_utils(self): """ Builds the utility applications. """ Loading Loading @@ -605,6 +612,8 @@ class HostBuild(): self._target_main() elif self.target == 'test': self._target_test() elif self.target == 'clippy': self._target_clippy() elif self.target == 'clean': self._target_clean() elif self.target == 'install': Loading system/gd/rust/linux/client/Cargo.toml +1 −1 Original line number Diff line number Diff line Loading @@ -25,7 +25,7 @@ tokio = { version = "1", features = ['bytes', 'fs', 'io-util', 'libc', 'macros', clap = "2.33.3" chrono = "0.4.24" bitflags = "1.2" bitflags = "2.4.0" hex = "0.4.3" [build-dependencies] pkg-config = "0.3.19" Loading system/gd/rust/linux/client/src/main.rs +6 −11 Original line number Diff line number Diff line Loading @@ -521,7 +521,7 @@ async fn handle_client_command( }); } 'readline: loop { 'foreground_actions: loop { let m = rx.recv().await; if m.is_none() { Loading Loading @@ -788,31 +788,26 @@ async fn handle_client_command( break; } Ok(line) => { // Currently Chrome OS uses Rust 1.60 so use the 1-time loop block to // workaround this. // With Rust 1.65 onwards we can convert this loop hack into a named block: // https://blog.rust-lang.org/2022/11/03/Rust-1.65.0.html#break-from-labeled-blocks // TODO: Use named block when Android and Chrome OS Rust upgrade Rust to 1.65. loop { 'readline: { let args = match shell_words::split(line.as_str()) { Ok(words) => words, Err(e) => { print_error!("Error parsing arguments: {}", e); break; break 'readline; } }; let (cmd, rest) = match args.split_first() { Some(pair) => pair, None => break, None => break 'readline, }; if cmd == "quit" { break 'readline; break 'foreground_actions; } handler.process_cmd_line(cmd, &rest.to_vec()); break; break 'readline; } // Ready to do readline again. Loading system/gd/rust/linux/stack/src/bluetooth.rs +1 −1 Original line number Diff line number Diff line Loading @@ -2246,7 +2246,7 @@ impl IBluetooth for Bluetooth { let intf = self.intf.lock().unwrap(); // Checks if the duration is valid. if mode == BtDiscMode::LimitedDiscoverable && (duration > 60 || duration <= 0) { if mode == BtDiscMode::LimitedDiscoverable && (duration > 60 || duration == 0) { warn!("Invalid duration for setting the device into limited discoverable mode. The valid duration is 1~60 seconds."); return false; } Loading system/gd/rust/linux/stack/src/bluetooth_media.rs +1 −4 Original line number Diff line number Diff line Loading @@ -2094,10 +2094,7 @@ impl BluetoothMedia { // Defaults to Idle if no calls are present. // Revisit this logic if the system supports multiple concurrent calls in the future (e.g., three-way-call). let mut call_state = CallState::Idle; for c in self.call_list.iter() { call_state = c.state; break; } self.call_list.first().map(|c| call_state = c.state); self.telephony_callbacks.lock().unwrap().for_all_callbacks(|callback| { callback.on_telephony_event(*addr, u8::from(event), u8::from(call_state)); }); Loading Loading
build.py +9 −0 Original line number Diff line number Diff line Loading @@ -76,6 +76,7 @@ VALID_TARGETS = [ 'prepare', # Prepare the output directory (gn gen + rust setup) 'rust', # Build only the rust components + copy artifacts to output dir 'test', # Run the unit tests 'clippy', # Run cargo clippy 'utils', # Build Floss utils ] Loading Loading @@ -494,6 +495,12 @@ class HostBuild(): cwd=os.path.join(self.output_dir), env=self.env) def _target_clippy(self): """ Runs cargo clippy, a collection of lints to catch common mistakes. """ cmd = ['cargo', 'clippy'] self.run_command('rust', cmd, cwd=os.path.join(self.platform_dir, 'bt'), env=self.env) def _target_utils(self): """ Builds the utility applications. """ Loading Loading @@ -605,6 +612,8 @@ class HostBuild(): self._target_main() elif self.target == 'test': self._target_test() elif self.target == 'clippy': self._target_clippy() elif self.target == 'clean': self._target_clean() elif self.target == 'install': Loading
system/gd/rust/linux/client/Cargo.toml +1 −1 Original line number Diff line number Diff line Loading @@ -25,7 +25,7 @@ tokio = { version = "1", features = ['bytes', 'fs', 'io-util', 'libc', 'macros', clap = "2.33.3" chrono = "0.4.24" bitflags = "1.2" bitflags = "2.4.0" hex = "0.4.3" [build-dependencies] pkg-config = "0.3.19" Loading
system/gd/rust/linux/client/src/main.rs +6 −11 Original line number Diff line number Diff line Loading @@ -521,7 +521,7 @@ async fn handle_client_command( }); } 'readline: loop { 'foreground_actions: loop { let m = rx.recv().await; if m.is_none() { Loading Loading @@ -788,31 +788,26 @@ async fn handle_client_command( break; } Ok(line) => { // Currently Chrome OS uses Rust 1.60 so use the 1-time loop block to // workaround this. // With Rust 1.65 onwards we can convert this loop hack into a named block: // https://blog.rust-lang.org/2022/11/03/Rust-1.65.0.html#break-from-labeled-blocks // TODO: Use named block when Android and Chrome OS Rust upgrade Rust to 1.65. loop { 'readline: { let args = match shell_words::split(line.as_str()) { Ok(words) => words, Err(e) => { print_error!("Error parsing arguments: {}", e); break; break 'readline; } }; let (cmd, rest) = match args.split_first() { Some(pair) => pair, None => break, None => break 'readline, }; if cmd == "quit" { break 'readline; break 'foreground_actions; } handler.process_cmd_line(cmd, &rest.to_vec()); break; break 'readline; } // Ready to do readline again. Loading
system/gd/rust/linux/stack/src/bluetooth.rs +1 −1 Original line number Diff line number Diff line Loading @@ -2246,7 +2246,7 @@ impl IBluetooth for Bluetooth { let intf = self.intf.lock().unwrap(); // Checks if the duration is valid. if mode == BtDiscMode::LimitedDiscoverable && (duration > 60 || duration <= 0) { if mode == BtDiscMode::LimitedDiscoverable && (duration > 60 || duration == 0) { warn!("Invalid duration for setting the device into limited discoverable mode. The valid duration is 1~60 seconds."); return false; } Loading
system/gd/rust/linux/stack/src/bluetooth_media.rs +1 −4 Original line number Diff line number Diff line Loading @@ -2094,10 +2094,7 @@ impl BluetoothMedia { // Defaults to Idle if no calls are present. // Revisit this logic if the system supports multiple concurrent calls in the future (e.g., three-way-call). let mut call_state = CallState::Idle; for c in self.call_list.iter() { call_state = c.state; break; } self.call_list.first().map(|c| call_state = c.state); self.telephony_callbacks.lock().unwrap().for_all_callbacks(|callback| { callback.on_telephony_event(*addr, u8::from(event), u8::from(call_state)); }); Loading