-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
omnia-5g-kit: Initial package to support 5G kit
- Loading branch information
Showing
2 changed files
with
96 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# | ||
# Copyright (C) 2024 CZ.NIC z.s.p.o. (http://www.nic.cz/) | ||
# | ||
# This is free software, licensed under the GNU General Public License v2. | ||
# See /LICENSE for more information. | ||
# | ||
|
||
include $(TOPDIR)/rules.mk | ||
|
||
PKG_NAME:=omnia-5g-kit | ||
PKG_VERSION:=v0.1 | ||
PKG_RELEASE:=$(AUTORELEASE) | ||
|
||
PKG_MAINTAINER:=CZ.NIC <[email protected]> | ||
PKG_LICENSE:=GPL-2.0 | ||
|
||
include $(INCLUDE_DIR)/package.mk | ||
|
||
define Package/omnia-5g-kit | ||
TITLE:=Support for Turris Omnia 5G kit | ||
DEPENDS:=@TARGET_mvebu_cortexa9_DEVICE_cznic_turris-omnia +nor-update | ||
CONFLICTS:=modem-manager-autosetup modem-manager | ||
endef | ||
|
||
define Package/omnia-5g-kit/description | ||
This package switches internal mPCIe slot into USB3 mode, reconfigures GSM | ||
network to work with our Quectell RM500U-EA 5G modem and also connects to the | ||
internet on every boot. | ||
endef | ||
|
||
define Build/Compile | ||
true | ||
endef | ||
|
||
define Package/omnia-5g-kit/install | ||
$(INSTALL_DIR) $(1)/etc/init.d | ||
$(INSTALL_BIN) ./files/5g-kit.init $(1)/etc/init.d/5g-kit | ||
endef | ||
|
||
define Package/omnia-5g-kit/postinst | ||
#!/bin/sh | ||
[ -n "$$IPKG_INSTROOT" ] || { | ||
/etc/init.d/5g-kit start | ||
uci batch << EOF | ||
delete network.gsm | ||
set network.gsm=interface | ||
set network.gsm.proto='dhcp' | ||
set network.gsm.device='usb0' | ||
set network.gsm.metric=2048 | ||
set network.gsm.ip6ifaceid='eui64' | ||
set network.gsm.ip6assign='64 | ||
set network.gsm6=interface | ||
set network.gsm6.device='@gsm' | ||
set network.gsm6.proto='dhcpv6'' | ||
EOF | ||
} | ||
|
||
|
||
define Package/omnia-5g-kit/prerm | ||
#!/bin/sh | ||
[ -n "$$IPKG_INSTROOT" ] || { | ||
fw_setenv omnia_wwan_slot pcie | ||
uci -q delete network.gsm | ||
uci -q delete network.gsm6 | ||
} | ||
endef | ||
|
||
$(eval $(call BuildPackage,omnia-5g-kit)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/bin/sh /etc/rc.common | ||
|
||
START=95 | ||
STOP=05 | ||
|
||
start() { | ||
local limit=0 | ||
if [ "$(fw_printenv omnia_wwan_slot)" != "omnia_wwan_slot=usb3" ]; then | ||
nor-update | ||
fw_setenv omnia_wwan_slot usb3 | ||
create_notification -s restart "Please reboot your router to complete 5G kit installation" | ||
return 0 | ||
fi | ||
while [ ! -e /dev/ttyUSB2 ] && [ "$limit" -lt 20 ]; do | ||
sleep 1 | ||
limit="$((limit + 1))" | ||
done | ||
if [ -e /dev/ttyUSB2 ]; then | ||
echo -ne 'ATZ\r\n' > /dev/ttyUSB2 | ||
echo -ne 'AT+CGDATA="M-ETHER",1\r\n' > /dev/ttyUSB2 | ||
fi | ||
} | ||
|
||
stop() { | ||
if [ -e /dev/ttyUSB2 ]; then | ||
echo -ne 'ATZ\r\n' > /dev/ttyUSB2 | ||
fi | ||
} |