The "cras" Command
The cras command in ChromeOS provides control over the ChromeOS Audio Server (CRAS), allowing users to manage audio features and simulate telephony events.
Command Overview
The basic syntax for the command is:
bash
cras [ enable <flag> | disable <flag> | telephony <event> [arg] ]
Understanding CRAS Features
Feature Flags
CRAS supports several feature flags that control audio behavior:
- Wideband Speech (wbs)
- Enables wideband speech mode in Bluetooth HFP
- Requires compatible Bluetooth controller and peripheral
-
Improves audio quality for voice communications
-
Noise Cancellation
- Enables noise cancellation processing
- Works with compatible input devices
- Reduces background noise in audio input
Telephony Events
The command supports various telephony events for Bluetooth HFP simulation: - Call management - Status indicators - System parameters - Connection states
Using the Command
Managing Feature Flags
-
Enable a feature:
bash cras enable wbs cras enable noise_cancellation -
Disable a feature:
bash cras disable wbs cras disable noise_cancellation
Managing Telephony Events
- Call Management: ```bash # Simulate incoming call cras telephony IncomingCall 12345678
# Answer call cras telephony AnswerCall
# End call cras telephony TerminateCall ```
- System Status: ```bash # Set battery level (0-5) cras telephony SetBatteryLevel 4
# Set signal strength (0-5) cras telephony SetSignalStrength 5
# Set service availability cras telephony SetServiceAvailability 1 ```
-
Call Status Management:
bash # Set call held status cras telephony SetCallheld 0 # No calls held cras telephony SetCallheld 1 # Call on hold or swapped cras telephony SetCallheld 2 # Call on hold, no active call -
Call Setup Status:
bash # Set call setup state cras telephony SetCallsetup 0 # No setup in progress cras telephony SetCallsetup 1 # Incoming call setup cras telephony SetCallsetup 2 # Outgoing call dialing cras telephony SetCallsetup 3 # Outgoing call alerting
Best Practices
Feature Management
- Flag Usage
- Test features before deployment
- Document enabled features
- Monitor system impact
-
Note reboot requirements
-
Telephony Testing
- Test complete call flows
- Verify status indicators
- Check system responses
- Document test scenarios
Common Use Cases
Audio Enhancement
- Enabling wideband speech for better call quality
- Activating noise cancellation for clearer input
- Testing audio features in different scenarios
- Optimizing audio settings for specific uses
Telephony Testing
- Simulating complete call flows
- Testing call handling
- Verifying status indicators
- Debugging telephony features
Safety Considerations
System Impact
- Feature Flags
- Changes don't persist after reboot
- May affect system performance
- Could impact battery life
-
Might affect other audio features
-
Telephony Simulation
- Test in controlled environment
- Monitor system resources
- Check for conflicts
- Verify normal operation
Troubleshooting
Common Issues
- Audio Problems
- Feature compatibility
- Device support
- Configuration issues
-
Performance impact
-
Telephony Simulation
- Event timing
- Status synchronization
- State management
- System response
Remember: Changes made using feature flags do not persist after a system reboot. Always document your changes and be prepared to reapply them after system restarts.