# LED Troubleshooting Guide

## Issue: LED Control Works But LED Doesn't Turn On

### Symptoms
- Commands execute successfully
- Brightness value changes correctly (0 for off, 255 for on)
- No physical LED visible or LED doesn't appear to turn on

### Possible Causes

1. **LED Not Installed on Your Model**
   - Not all reTerminal DM4 units may have a physical `usr-led` installed
   - The control interface exists in software but hardware may be missing
   - Check your specific model's documentation from Seeed Studio

2. **LED Location Not Visible**
   - The LED may be in a location that's difficult to see
   - May require specific viewing angle or lighting conditions
   - Check around the screen bezel, especially near buzzer location

3. **LED Requires Different Control Method**
   - Some LEDs may need to be controlled via GPIO directly
   - May require specific initialization sequence

### Verification Steps

1. **Check LED Device Exists:**
   ```bash
   ls -la /sys/class/leds/usr-led/
   cat /sys/class/leds/usr-led/brightness
   cat /sys/class/leds/usr-led/max_brightness
   ```

2. **Test Control Interface:**
   ```bash
   # Turn OFF
   echo 0 | sudo tee /sys/class/leds/usr-led/brightness
   cat /sys/class/leds/usr-led/brightness  # Should show 0
   
   # Turn ON
   echo 1 | sudo tee /sys/class/leds/usr-led/brightness
   cat /sys/class/leds/usr-led/brightness  # Should show 255
   ```

3. **Test with Triggers:**
   ```bash
   # Try default-on trigger
   echo default-on | sudo tee /sys/class/leds/usr-led/trigger
   sleep 2
   cat /sys/class/leds/usr-led/brightness  # Should show 255
   
   # Return to manual
   echo none | sudo tee /sys/class/leds/usr-led/trigger
   ```

4. **Check Hardware Info:**
   ```bash
   cat /sys/class/leds/usr-led/uevent
   dmesg | grep -i led
   ```

### Official Documentation Status

According to Seeed Studio's official documentation:
- The reTerminal DM has a **buzzer** that is well-documented and confirmed to work
- The **LED indicator** (`usr-led`) control is mentioned but may not be physically present on all models
- Some documentation sources indicate the LED may be system-managed rather than user-controllable

### Recommendations

1. **Contact Seeed Studio Support**
   - Verify if your specific model includes a user-controllable LED
   - Request model-specific documentation
   - Ask about LED location and visibility

2. **Use Alternative Indicators**
   - Use the buzzer for audio feedback
   - Use screen display for visual feedback
   - Use system LEDs (ACT, PWR) if available (though these are typically read-only)

3. **Check Model Variants**
   - Different reTerminal DM variants may have different hardware configurations
   - Verify your exact model number and compare with official specifications

### Alternative: GPIO Direct Control

If the LED subsystem doesn't work, you can try controlling via GPIO directly:

```bash
# The LED is on PCA9535 GPIO expander (base GPIO 578)
# You would need to export the specific GPIO pin
# This requires knowing the exact pin number on the PCA9535

# Example (may need adjustment):
GPIO_PIN=578  # Base + pin offset
echo $GPIO_PIN | sudo tee /sys/class/gpio/export
echo out | sudo tee /sys/class/gpio/gpio$GPIO_PIN/direction
echo 1 | sudo tee /sys/class/gpio/gpio$GPIO_PIN/value  # ON
echo 0 | sudo tee /sys/class/gpio/gpio$GPIO_PIN/value  # OFF
```

**Note**: GPIO direct control requires knowing the exact pin mapping, which may not be documented.

### Conclusion

The LED control interface is functional and accepts commands correctly. If the LED doesn't physically turn on:
- The control software is working
- The hardware may not be present on your model
- Contact Seeed Studio for model-specific information
- Consider using buzzer or screen display as alternatives
