diff --git a/net/modemband/Makefile b/net/modemband/Makefile index 4ead5d9be6..b435ef6c2d 100644 --- a/net/modemband/Makefile +++ b/net/modemband/Makefile @@ -1,7 +1,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=modemband -PKG_VERSION:=20240204 +PKG_VERSION:=20240616 PKG_RELEASE:=1 PKG_LICENSE:=MIT diff --git a/net/modemband/README.md b/net/modemband/README.md index 39676e2301..f0b327b272 100644 --- a/net/modemband/README.md +++ b/net/modemband/README.md @@ -3,9 +3,11 @@ Setting LTE/5G NSA/5G SA bands for selected modems. Supported devices: - BroadMobi BM806U - Dell DW5821e Snapdragon X20 LTE (Foxconn T77W968) +- Fibocom FM350-GL - Fibocom L850-GL - Fibocom L850-GL in mbim mode - Fibocom L860-GL +- Fibocom L860-GL-16 - HP lt4112 (Huawei ME906E) - HP lt4132 LTE/HSPA+ 4G Module (Huawei ME906s-158) - HP lt4220 (Foxconn T77W676) @@ -23,6 +25,7 @@ Supported devices: - Quectel RM500Q-GL - Quectel RM500U-CNV - Quectel RM502Q-AE +- Quectel RM502Q-GL - Quectel RM505Q-AE - Quectel RM520N-GL - Sierra Wireless EM7455/MC7455/DW5811e @@ -32,6 +35,7 @@ Supported devices: - Telit LN940 (Foxconn T77W676) in mbim mode - Telit LN960 (Foxconn T77W968) - Telit LN960 +- Yuge CLM920 NC_5 - ZTE MF286 (router) - ZTE MF286A (router) - ZTE MF286D (router) diff --git a/net/modemband/files/usr/bin/modemband.sh b/net/modemband/files/usr/bin/modemband.sh index 8d46536cbd..cd0eca61e0 100644 --- a/net/modemband/files/usr/bin/modemband.sh +++ b/net/modemband/files/usr/bin/modemband.sh @@ -3,6 +3,8 @@ # # (c) 2022-2024 Cezary Jackiewicz # +# (c) 2022-2024 modified by RafaƂ Wabik - IceG - From eko.one.pl forum +# hextobands() { BANDS="" diff --git a/net/modemband/files/usr/share/modemband/05c69625 b/net/modemband/files/usr/share/modemband/05c69625 new file mode 100644 index 0000000000..e7768370f5 --- /dev/null +++ b/net/modemband/files/usr/share/modemband/05c69625 @@ -0,0 +1,36 @@ +_DEVICE=/dev/ttyUSB2 +_DEFAULT_LTE_BANDS="1 3 5 8 38 39 40 41" + +getinfo() { + echo "Yuge CLM920 NC_5" +} + +getsupportedbands() { + echo "$_DEFAULT_LTE_BANDS" +} + +getbands() { + O=$(sms_tool -d $_DEVICE at "as+bandcfg?") + HEXHI=$(echo "$O" | awk -F[,] '/^\+BANDCFG:3,/{print $2}' | xargs) + HEXLO=$(echo "$O" | awk -F[,] '/^\+BANDCFG:3,/{print $3}' | xargs) + hextobands $(printf "0x%x%08x" 0x${HEXHI:-0} 0x${HEXLO:-0}) +} + +setbands() { + BANDS="$1" + [ "$BANDS" = "default" ] && BANDS="$_DEFAULT_LTE_BANDS" + + HEX=$(bandstohex "$BANDS") + LEN=${#HEX} + if [ $LEN -gt 8 ]; then + CNT=$((LEN - 8)) + HEXHI=${HEX:0:CNT} + HEXLO=${HEX:CNT} + else + HEXLO=$HEX + HEXHI=0 + fi + HEXHI=$(printf "%X" 0x$HEXHI) + HEXLO=$(printf "%X" 0x$HEXLO) + [ "$HEX" != "0" ] && sms_tool -d $_DEVICE at "at+bandcfg=$HEXHI,$HEXLO,3" +} diff --git a/net/modemband/files/usr/share/modemband/0e8d7126 b/net/modemband/files/usr/share/modemband/0e8d7126 new file mode 100644 index 0000000000..3991aaca1c --- /dev/null +++ b/net/modemband/files/usr/share/modemband/0e8d7126 @@ -0,0 +1,4 @@ +# +GTUSBMODE: 40 +_DEVICE=/dev/ttyUSB2 + +. $RES/_fibocom_fm350_common diff --git a/net/modemband/files/usr/share/modemband/0e8d7127 b/net/modemband/files/usr/share/modemband/0e8d7127 new file mode 100644 index 0000000000..908a378f67 --- /dev/null +++ b/net/modemband/files/usr/share/modemband/0e8d7127 @@ -0,0 +1,4 @@ +# +GTUSBMODE: 41 +_DEVICE=/dev/ttyUSB4 + +. $RES/_fibocom_fm350_common diff --git a/net/modemband/files/usr/share/modemband/11999091 b/net/modemband/files/usr/share/modemband/11999091 new file mode 100644 index 0000000000..bdbdded6ff --- /dev/null +++ b/net/modemband/files/usr/share/modemband/11999091 @@ -0,0 +1,47 @@ +_DEVICE=/dev/ttyUSB2 + +getinfo() { + echo "Sierra Wireless EM7465" +} + +getsupportedbands() { + sms_tool -d $_DEVICE at 'AT!ENTERCND="A710"' >/dev/null 2>&1 + O=$(sms_tool -d $_DEVICE at 'AT!BAND=?') + HEX=$(echo "$O" | awk '/^00, All bands/{printf "0x%s%s\n", $6, $5}') + [ "$HEX" = "0x" ] || hextobands "$HEX" +} + +getbands() { + sms_tool -d $_DEVICE at 'AT!ENTERCND="A710"' >/dev/null 2>&1 + O=$(sms_tool -d $_DEVICE at 'AT!BAND?') + HEX=$(echo "$O" | awk -F, '/^[0-9a-fA-F][0-9a-fA-F],/{print $3}' | awk '{printf "0x%s%s\n", $3, $2}') + [ "$HEX" = "0x" ] || hextobands "$HEX" +} + +setbands() { + BANDS="$1" + + if [ "$BANDS" = "default" ]; then + sms_tool -d $_DEVICE at 'AT!ENTERCND="A710"' >/dev/null 2>&1 + sms_tool -d $_DEVICE at 'AT!BAND=00' >/dev/null 2>&1 + else + HEX=$(bandstohex "$BANDS") + if [ "$HEX" != "0" ]; then + sms_tool -d $_DEVICE at 'AT!ENTERCND="A710"' >/dev/null 2>&1 + O=$(sms_tool -d $_DEVICE at 'AT!BAND?') + HEXGW=$(echo "$O" | awk -F, '/^[0-9a-fA-F][0-9a-fA-F],/{print $3}' | awk '{print $1}') + LEN=${#HEX} + if [ $LEN -gt 16 ]; then + CNT=$((LEN - 16)) + HEXL2=${HEX:0:CNT} + HEXL1=${HEX:CNT} + else + HEXL1=$HEX + HEXL2=0 + fi + sms_tool -d $_DEVICE at 'AT!BAND=10,"Custom bands",'$HEXGW','$HEXL1','$HEXL2 + sms_tool -d $_DEVICE at 'AT!BAND=10' + sms_tool -d $_DEVICE at 'AT!RESET' + fi + fi +} diff --git a/net/modemband/files/usr/share/modemband/1e0e9001 b/net/modemband/files/usr/share/modemband/1e0e9001 index 289b3be93f..04c554aacb 100644 --- a/net/modemband/files/usr/share/modemband/1e0e9001 +++ b/net/modemband/files/usr/share/modemband/1e0e9001 @@ -43,7 +43,7 @@ getbands5gnsa() { setbands5gnsa() { BANDS="$1" - [ "$BANDS" = "default" ] && BANDS="$_DEFAULT_LTE_BANDS" + [ "$BANDS" = "default" ] && BANDS="$_DEFAULT_5GNSA_BANDS" T="" for BAND in $BANDS; do @@ -68,7 +68,7 @@ getbands5gsa() { setbands5gsa() { BANDS="$1" - [ "$BANDS" = "default" ] && BANDS="$_DEFAULT_5GNSA_BANDS" + [ "$BANDS" = "default" ] && BANDS="$_DEFAULT_5GSA_BANDS" T="" for BAND in $BANDS; do diff --git a/net/modemband/files/usr/share/modemband/2c7c0800RM502Q-GL b/net/modemband/files/usr/share/modemband/2c7c0800RM502Q-GL new file mode 100644 index 0000000000..174e852398 --- /dev/null +++ b/net/modemband/files/usr/share/modemband/2c7c0800RM502Q-GL @@ -0,0 +1,12 @@ +_DEVICE=/dev/ttyUSB2 +_DEFAULT_LTE_BANDS="1 2 3 4 5 7 8 12 13 14 17 18 19 20 25 26 28 29 30 32 34 38/39 40 41 42 43 48 66 71" +_DEFAULT_5GNSA_BANDS="38 41 77 78" +_DEFAULT_5GSA_BANDS="1 2 3 5 7 8 12 20 25 28 38 40 41 48 66 71 77 78" + +getinfo() { + echo "Quectel RM502Q-GL" +} + +# +QNWPREFCFG: "lte_band",1:3:7:8:20:28:38 + +. $RES/_quectel_common2 diff --git a/net/modemband/files/usr/share/modemband/8087095a b/net/modemband/files/usr/share/modemband/8087095a index 6f3f041414..12f533e2f5 100644 --- a/net/modemband/files/usr/share/modemband/8087095a +++ b/net/modemband/files/usr/share/modemband/8087095a @@ -2,12 +2,7 @@ _DEVICE=/dev/ttyACM2 getinfo() { O=$(sms_tool -d $_DEVICE at "at+gmm") - if echo "$O" | grep -q "L850"; then - _NAME="Fibocom L850-GL" - fi - if echo "$O" | grep -q "L860"; then - _NAME="Fibocom L860-GL" - fi + _NAME="Fibocom $(echo "$O" | awk -F, '{print $2}')" echo "$_NAME" } @@ -19,6 +14,9 @@ getsupportedbands() { if echo "$O" | grep -q "L860"; then _DEFAULT_LTE_BANDS="1 2 3 4 5 7 8 12 13 14 17 18 19 20 25 26 28 29 30 32 38 39 40 41 42 46 66" fi + if echo "$O" | grep -q "L860-GL-16"; then + _DEFAULT_LTE_BANDS="1 2 3 4 5 7 8 12 13 14 17 18 19 20 25 26 28 29 30 32 34 38 39 40 41 42 43 46 48 66 71" + fi echo "$_DEFAULT_LTE_BANDS" } diff --git a/net/modemband/files/usr/share/modemband/_fibocom_fm350_common b/net/modemband/files/usr/share/modemband/_fibocom_fm350_common new file mode 100644 index 0000000000..53a3e28fd8 --- /dev/null +++ b/net/modemband/files/usr/share/modemband/_fibocom_fm350_common @@ -0,0 +1,87 @@ +getinfo() { + O=$(sms_tool -d $_DEVICE at "AT+CGMM?") + _NAME="Fibocom $(echo "$O" | awk -F[:,] '/^\+CGMM:/{gsub("\"","");print $2}' | xargs)" + echo "$_NAME" +} + +getsupportedbands() { + _DEFAULT_LTE_BANDS="1 2 3 4 5 7 8 12 13 14 17 18 19 20 25 26 28 29 30 32 34 38 39 40 41 42 43 46 48 66 71" + echo "$_DEFAULT_LTE_BANDS" +} + +getbands() { + # +GTACT: 20,6,3,101,102,103,104,105,107,108,112,113,114,117,118,119,120,125,126,128,129,130,132,134,138,139,140,141,142,143,146,148,166,171 + + O=$(sms_tool -d $_DEVICE at "AT+GTACT?") + BANDS=$(echo "$O" | awk -F: '/^\+GTACT:/{gsub(","," ");print $2}') + for BAND in $BANDS; do + if [ $BAND -gt 100 ] && [ $BAND -lt 200 ]; then + echo -n "$((BAND - 100)) " + fi + done + echo "" +} + +setbands() { + BANDS="$1" + + T="" + if [ "$BANDS" = "default" ]; then + T="0" + else + for BAND in $BANDS; do + case $BAND in + ''|*[!0-9]*) continue ;; + esac + [ -n "$T" ] && T="${T}," + T="${T}$((BAND + 100))" + done + fi + + if [ -n "$T" ]; then + O=$(sms_tool -d $_DEVICE at "AT+GTACT?") + MODE=$(echo "$O" | awk -F[:,] '/\+GTACT:/{print $2","$3","$4}'| xargs) + sms_tool -d $_DEVICE at "AT+GTACT=$MODE,$T" + fi +} + +getsupportedbands5gsa() { + _DEFAULT_5GSA_BANDS="1 2 3 5 7 8 20 25 28 30 38 40 41 48 66 71 77 78 79" + echo "$_DEFAULT_5GSA_BANDS" +} + +getbands5gsa() { + # +GTACT: 20,6,3,501,502,503,505,507,508,5020,5025,5028,5030,5038,5040,5041,5048,5066,5071,5077,5078,5079 + + O=$(sms_tool -d $_DEVICE at "AT+GTACT?") + BANDS=$(echo "$O" | awk -F: '/^\+GTACT:/{gsub(","," ");print $2}') + for BAND in $BANDS; do + if [ $BAND -gt 500 ] && [ $BAND -lt 5100 ]; then + echo -n "$(echo "$BAND" | sed 's/^50//g') " + fi + done + echo "" +} + +setbands5gsa() { + BANDS="$1" + + T="" + if [ "$BANDS" = "default" ]; then + T="0" + else + for BAND in $BANDS; do + case $BAND in + ''|*[!0-9]*) continue ;; + esac + [ -n "$T" ] && T="${T}," + T="${T}50${BAND}" + done + fi + + if [ -n "$T" ]; then + O=$(sms_tool -d $_DEVICE at "AT+GTACT?") + MODE=$(echo "$O" | awk -F[:,] '/\+GTACT:/{print $2","$3","$4}'| xargs) + sms_tool -d $_DEVICE at "AT+GTACT=$MODE,$T" + fi +}