Skip to content

Conversation

Copy link

Copilot AI commented Nov 17, 2025

Description

Enables on-demand builds via GitHub Actions UI and adds comprehensive support for Quectel RM551E-GL 5G modems across all USB modes.

On-Demand Builds

  • Client builds: Added workflow_dispatch to build.yml with selectable target platform and kernel version
  • VPS builds: New build-vps.yml workflow for independent VPS package generation
  • Reduces single-platform build time from 6+ hours to ~45 minutes

Quectel RM551E-GL Support

Problem: RM551E enumerates with different PIDs depending on USB mode, causing detection failures.

Solution:

  • Added modem configs for all USB modes: 2c7c:0800 (MBIM), 2c7c:0801 (QMI), 2c7c:0900 (RNDIS), 2c7c:0901 (NCM)
  • New rm551e-init.sh: Automatic initialization on hotplug with mode detection
  • Enhanced modem-ca-optimize.sh: RM551E-specific carrier aggregation (5G NR CA, EN-DC, 32KB URB/64 datagrams)
  • Hotplug integration: /etc/hotplug.d/usb/99-modem-init auto-configures on USB connect

Key optimizations:

AT+QNWCFG="nr5g_carrier_aggregation",1  # 4-band CA
AT+QNWCFG="endc",1                      # LTE+5G aggregation
AT+QCFG="data_aggregation",1,32768,64   # Optimized URB

Files Changed

Workflows:

  • .github/workflows/build.yml - Added workflow_dispatch matrix conditionals
  • .github/workflows/build-vps.yml - New VPS-specific workflow

Modem Support:

  • common/package/modems/Makefile - Script installation + hotplug rules
  • common/package/modems/files/rm551e-init.sh - New auto-init script
  • common/package/modems/files/modem-ca-optimize.sh - Enhanced with RM551E detection
  • common/package/modems/src/data/2c7c-{0800,0900,0901} - Additional USB mode configs

Documentation:

  • ON_DEMAND_BUILDS.md - Workflow usage guide
  • RM551E_QUICK_REF.md - AT commands reference
  • common/package/modems/src/README_RM551E.md - Detailed modem documentation
  • README.md - Updated with feature overview

Validation

  • YAML/JSON/shell syntax validated
  • Backward compatible - no breaking changes
  • Existing modem support unaffected

Checklist

  • Code follows contribution guidelines
  • Documentation updated
  • No breaking changes
  • Backward compatible with existing builds
Original prompt

I need to be able to build images of client and VPs on demand and I'm having quectel 551e model issues


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@devloai
Copy link

devloai bot commented Nov 17, 2025

Unable to perform a code review. You have run out of credits 😔
Please upgrade your plan or buy additional credits from the subscription page.

Copilot AI and others added 3 commits November 17, 2025 02:38
Co-authored-by: spotty118 <19340462+spotty118@users.noreply.github.com>
Co-authored-by: spotty118 <19340462+spotty118@users.noreply.github.com>
Co-authored-by: spotty118 <19340462+spotty118@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix issues with Quectel 551E model for image building Add workflow_dispatch for on-demand builds and fix Quectel RM551E-GL modem detection Nov 17, 2025
Copilot AI requested a review from spotty118 November 17, 2025 02:45
Copilot finished work on behalf of spotty118 November 17, 2025 02:45
@spotty118 spotty118 marked this pull request as ready for review November 17, 2025 02:52
Copilot AI review requested due to automatic review settings November 17, 2025 02:52
@spotty118 spotty118 merged commit be35c4c into develop Nov 17, 2025
Copilot finished reviewing on behalf of spotty118 November 17, 2025 03:06
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request adds two major features: on-demand GitHub Actions builds and comprehensive Quectel RM551E-GL 5G modem support.

  • Enables workflow dispatch for selective platform/kernel builds, reducing build time from 6+ hours to ~45 minutes for single platforms
  • Adds automatic detection and optimization for RM551E modems across all USB modes (QMI, MBIM, RNDIS, NCM)
  • Includes comprehensive documentation for both features

Reviewed Changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
.github/workflows/build.yml Added workflow_dispatch trigger with platform and kernel selection inputs; updated matrix to support conditional builds
.github/workflows/build-vps.yml New workflow for VPS package builds with distribution type selection
common/package/modems/Makefile Added installation of modem optimization scripts and hotplug rules for automatic RM551E initialization
common/package/modems/files/rm551e-init.sh New initialization script for automatic RM551E modem detection, driver loading, and configuration
common/package/modems/files/modem-ca-optimize.sh Enhanced carrier aggregation script with RM551E-specific optimizations (5G NR CA, EN-DC, data aggregation)
common/package/modems/src/data/2c7c-0800 Modem configuration for RM551E MBIM mode (PID 0x0800)
common/package/modems/src/data/2c7c-0900 Modem configuration for RM551E RNDIS mode (PID 0x0900)
common/package/modems/src/data/2c7c-0901 Modem configuration for RM551E NCM mode (PID 0x0901)
common/package/modems/src/README_RM551E.md Comprehensive documentation for RM551E support, configuration, and troubleshooting
RM551E_QUICK_REF.md Quick reference guide for RM551E AT commands and common operations
ON_DEMAND_BUILDS.md User guide for triggering on-demand builds via GitHub Actions
TEST_PLAN.md Detailed test plan for validating workflow and modem support features
README.md Updated with on-demand build instructions and RM551E modem support information

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

# Install init scripts
$(INSTALL_DIR) $(1)/etc/hotplug.d/usb
echo '#!/bin/sh' > $(1)/etc/hotplug.d/usb/99-modem-init
echo '[ "$$ACTION" = "add" ] && [ "$$PRODUCT" = "2c7c/800/*" -o "$$PRODUCT" = "2c7c/801/*" -o "$$PRODUCT" = "2c7c/900/*" -o "$$PRODUCT" = "2c7c/901/*" ] && /usr/bin/rm551e-init.sh &' >> $(1)/etc/hotplug.d/usb/99-modem-init
Copy link

Copilot AI Nov 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The hotplug rule uses a long chain of -o (OR) operators without proper grouping, which can lead to unexpected behavior due to operator precedence. The condition should use explicit grouping or be split for better maintainability.

Consider restructuring to:

echo '[ "$$ACTION" = "add" ] && { [ "$$PRODUCT" = "2c7c/800/*" ] || [ "$$PRODUCT" = "2c7c/801/*" ] || [ "$$PRODUCT" = "2c7c/900/*" ] || [ "$$PRODUCT" = "2c7c/901/*" ]; } && /usr/bin/rm551e-init.sh &' >> $(1)/etc/hotplug.d/usb/99-modem-init

Or use a case statement for better readability:

case "$$PRODUCT" in
    2c7c/800/*|2c7c/801/*|2c7c/900/*|2c7c/901/*)
        /usr/bin/rm551e-init.sh &
        ;;
esac
Suggested change
echo '[ "$$ACTION" = "add" ] && [ "$$PRODUCT" = "2c7c/800/*" -o "$$PRODUCT" = "2c7c/801/*" -o "$$PRODUCT" = "2c7c/900/*" -o "$$PRODUCT" = "2c7c/901/*" ] && /usr/bin/rm551e-init.sh &' >> $(1)/etc/hotplug.d/usb/99-modem-init
echo '[ "$$ACTION" = "add" ] && { [ "$$PRODUCT" = "2c7c/800/*" ] || [ "$$PRODUCT" = "2c7c/801/*" ] || [ "$$PRODUCT" = "2c7c/900/*" ] || [ "$$PRODUCT" = "2c7c/901/*" ]; } && /usr/bin/rm551e-init.sh &' >> $(1)/etc/hotplug.d/usb/99-modem-init

Copilot uses AI. Check for mistakes.
for dev in /dev/ttyUSB*; do
if [ -c "$dev" ]; then
# Try to communicate with the device
if timeout 2 sh -c "echo AT > $dev && cat $dev 2>/dev/null" | grep -q "OK"; then
Copy link

Copilot AI Nov 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variable $dev is not properly quoted inside the sh -c command string. While unlikely to cause issues with /dev paths, this is a shell best practice violation that could lead to word splitting or pathname expansion issues.

The command should be:

if timeout 2 sh -c "echo AT > \"$dev\" && cat \"$dev\" 2>/dev/null" | grep -q "OK"; then

Alternatively, use a different approach that doesn't require embedding the variable in the string:

if echo AT > "$dev" 2>/dev/null && timeout 2 cat "$dev" 2>/dev/null | grep -q "OK"; then
Suggested change
if timeout 2 sh -c "echo AT > $dev && cat $dev 2>/dev/null" | grep -q "OK"; then
if timeout 2 sh -c "echo AT > \"$dev\" && cat \"$dev\" 2>/dev/null" | grep -q "OK"; then

Copilot uses AI. Check for mistakes.
workflow_dispatch:
inputs:
target:
description: 'Target platform (leave empty for all)'
Copy link

Copilot AI Nov 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The description says "leave empty for all" but since this is a type: choice input, users cannot leave it empty - they must select from the dropdown options. The description should be updated to reflect the actual behavior.

Suggested change:

description: 'Target platform to build (select "all" to build all platforms)'
Suggested change
description: 'Target platform (leave empty for all)'
description: 'Target platform to build (select "all" to build all platforms)'

Copilot uses AI. Check for mistakes.
- 'gl-mt6000'
default: 'all'
kernel:
description: 'Kernel version (leave empty for all)'
Copy link

Copilot AI Nov 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The description says "leave empty for all" but since this is a type: choice input, users cannot leave it empty - they must select from the dropdown options. The description should be updated to reflect the actual behavior.

Suggested change:

description: 'Kernel version to use (select "all" to build both versions)'
Suggested change
description: 'Kernel version (leave empty for all)'
description: 'Kernel version to use (select "all" to build both versions)'

Copilot uses AI. Check for mistakes.
{
"desc": "Quectel RM551E-GL 5G (RNDIS mode)",
"type": "rndis_host",
"control": 2,
Copy link

Copilot AI Nov 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The RNDIS mode configuration uses "control": 2 while the other RM551E modes (MBIM, QMI, NCM) use "control": 4. This inconsistency should be verified against the modem's hardware specifications.

If RNDIS mode truly uses a different control interface number, this is correct. However, if all RM551E modes should use the same control interface, this should be changed to "control": 4 for consistency with the other configurations.

Suggested change
"control": 2,
"control": 4,

Copilot uses AI. Check for mistakes.
Comment on lines +5 to +14
inputs:
vps_type:
description: 'VPS distribution type'
required: true
type: choice
options:
- 'debian'
- 'ubuntu'
- 'all'
default: 'all'
Copy link

Copilot AI Nov 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The workflow defines a vps_type input with options for 'debian', 'ubuntu', and 'all', but this input is never used in the workflow. The build steps always package all VPS scripts regardless of the selected option.

Either:

  1. Remove the unused vps_type input if the workflow is meant to always build all types, or
  2. Implement conditional logic to filter/build based on the selected VPS type

Currently, the input misleads users into thinking they can select a specific distribution type when it has no effect.

Suggested change
inputs:
vps_type:
description: 'VPS distribution type'
required: true
type: choice
options:
- 'debian'
- 'ubuntu'
- 'all'
default: 'all'

Copilot uses AI. Check for mistakes.
fi
done

return $found
Copy link

Copilot AI Nov 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The return value logic is inverted. In shell scripts, return code 0 indicates success and non-zero indicates failure. When found=1 (modem detected), the function returns 1, which is interpreted as failure by the calling code at line 94. This causes the script to exit when a modem IS detected, instead of when it's NOT detected.

Fix by changing line 26 to:

return $(( 1 - found ))

Or alternatively:

[ $found -eq 1 ]
return $?
Suggested change
return $found
return $(( 1 - found ))

Copilot uses AI. Check for mistakes.
send_at_command "$device" "AT+CFUN=0" 2

# Configure USB mode for optimal performance
# Mode 3 = QMI, Mode 1 = MBIM, Mode 0 = RNDIS
Copy link

Copilot AI Nov 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The USB mode comment is incorrect. According to the documentation and AT commands used throughout the codebase:

  • Mode 0 = QMI (not Mode 3)
  • Mode 1 = MBIM
  • Mode 5 = RNDIS (not Mode 0)

There is no Mode 3 for this modem. The comment should be:

# Mode 0 = QMI, Mode 1 = MBIM, Mode 5 = RNDIS

This is consistent with the AT command on line 46 which sets mode 0 for QMI, and with the documentation in README_RM551E.md and RM551E_QUICK_REF.md.

Suggested change
# Mode 3 = QMI, Mode 1 = MBIM, Mode 0 = RNDIS
# Mode 0 = QMI, Mode 1 = MBIM, Mode 5 = RNDIS

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants