-
Notifications
You must be signed in to change notification settings - Fork 3.8k
xs2184-tsw202: Add package to control PoE for Teltonika TSW202 devices #27991
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
stargieg
wants to merge
1
commit into
openwrt:master
Choose a base branch
from
stargieg:xs2184
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,53 @@ | ||
| include $(TOPDIR)/rules.mk | ||
|
|
||
|
|
||
| PKG_NAME:=xs2184-tsw202 | ||
| PKG_VERSION:=1.0.2 | ||
| PKG_RELEASE:=1 | ||
|
|
||
| PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME) | ||
| PKG_MAINTAINER:=patrick <[email protected]> | ||
|
|
||
| include $(INCLUDE_DIR)/package.mk | ||
|
|
||
| ifeq ($(CONFIG_BIG_ENDIAN),y) | ||
| TARGET_CFLAGS+= -DHAVE_BIG_ENDIAN=1 | ||
| endif | ||
| TARGET_CFLAGS+= -D_GNU_SOURCE | ||
|
|
||
| define Package/xs2184-tsw202 | ||
| SECTION:=Applications | ||
| CATEGORY:=Network | ||
| SECTION:=utils | ||
| CATEGORY:=Utilities | ||
| TITLE:=XinSheng PoE/PSE i2c driver for Teltonika TSW202 Switch | ||
| DEPENDS:=+i2c-tools +libuci | ||
| endef | ||
|
|
||
| define Package/xs2184-tsw202/description | ||
| ZheJiang XinSheng PoE/PSE SoC devices drivers; | ||
| endef | ||
|
|
||
| define Build/Prepare | ||
| mkdir -p $(PKG_BUILD_DIR) | ||
| $(CP) ./files $(PKG_BUILD_DIR)/ | ||
| endef | ||
|
|
||
| define Build/Compile | ||
| $(MAKE) -C $(PKG_BUILD_DIR)/files \ | ||
| $(TARGET_CONFIGURE_OPTS) \ | ||
| TARGET=Linux \ | ||
| CFLAGS="$(TARGET_CFLAGS)" \ | ||
| LDFLAGS="$(TARGET_LDFLAGS)" | ||
| endef | ||
|
|
||
| define Package/xs2184-tsw202/install | ||
| $(INSTALL_DIR) $(1)/usr/sbin | ||
| $(INSTALL_BIN) $(PKG_BUILD_DIR)/files/xs2184 $(1)/usr/sbin/ | ||
| $(INSTALL_DIR) $(1)/etc/init.d | ||
| $(INSTALL_BIN) ./files/xs2184.init $(1)/etc/init.d/xs2184 | ||
| $(INSTALL_DIR) $(1)/etc/config | ||
| $(INSTALL_DATA) ./files/xs2184.config $(1)/etc/config/xs2184 | ||
| endef | ||
|
|
||
| $(eval $(call BuildPackage,xs2184-tsw202)) |
This file contains hidden or 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,47 @@ | ||
| # XS2184 PSE driver and monitor app | ||
|
|
||
| ## 检测原理 | ||
| - 正常工作时, PSE 协商使能, 供电给 PD, 并统计15轮 实时功耗; | ||
| - 当平均功耗 为0, 判定 PD 出现异常, 关闭 PSE 对应 Port的供电; | ||
| - 被关闭的 Port, 在下一轮统计时, 重新开启协商供电使能; | ||
| - 实测, MS1800K 在 上电复位异常情况下, 实时功耗 为0 mW, 能被识别出异常, 并断电重启; | ||
|
|
||
| ## 测试方法 | ||
| 1. 正常 PoE - PD 组网; | ||
| 2. 后台执行: xs2184 -m 1000; | ||
| 3. xs2184 监听模式, 参数 -m: monitor 模式, 检测间隔 1000ms, 平均功耗计算周期: 默认 15 轮, -s <ms> 可修改; | ||
| 4. 观察 xs2184 日志, 会实时打印功耗和检测状态; | ||
| 5. 用镊子短路 MS1800K 的 C133 复位电容, 模拟上电无法启动的情况; | ||
| 6. 重复4), 对比关电和重新上电的行为, 以及MS1800K重新开机和功耗变化; | ||
|
|
||
| ## Funktionsprinzip | ||
| - Im Normalbetrieb verhandelt die PSE die Freigabe, versorgt das PD mit Strom und zeichnet den Stromverbrauch in Echtzeit über 15 Zyklen auf. | ||
| - Wenn der durchschnittliche Stromverbrauch Null erreicht, wird das PD als fehlerhaft eingestuft und die PSE unterbricht die Stromversorgung des entsprechenden Ports. | ||
| - Der deaktivierte Port verhandelt während des nächsten Verbrauchszyklus erneut die Freigabe der Stromversorgung. | ||
| - Feldtests bestätigen, dass der MS1800K unter abnormalen Power-On-Reset-Bedingungen einen Echtzeit-Stromverbrauch von null mW aufweist, was die Erkennung von Anomalien und den anschließenden Neustart nach dem Ausschalten ermöglicht. | ||
|
|
||
| ## Testmethodik | ||
| 1. Standard-PoE-PD-Netzwerkkonfiguration. | ||
| 2. Hintergrundausführung: xs2184 -m 1000. | ||
| 3. xs2184-Überwachungsmodus, Parameter -m: Überwachungsmodus, Erkennungsintervall 1000 ms, durchschnittlicher Stromverbrauchsberechnungszyklus: standardmäßig 15 Runden, änderbar mit -s in ms; | ||
| 4. Beobachten Sie die xs2184-Protokolle, die den Stromverbrauch und den Erkennungsstatus in Echtzeit anzeigen. | ||
| 5. Verwenden Sie eine Pinzette, um den C133-Reset-Kondensator des MS1800K kurzzuschließen und so einen Fehler beim Hochfahren nach dem Einschalten zu simulieren. | ||
| 6. Wiederholen Sie Schritt 4 und vergleichen Sie das Verhalten nach dem Ausschalten und erneuten Einschalten mit dem Neustart des MS1800K und den Änderungen des Stromverbrauchs. | ||
|
|
||
| ## UI einfach | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why add it to luci? No, no, no. :( |
||
| ``` | ||
| uci add luci command | ||
| uci set luci.@command[-1].name="poe-status" | ||
| uci set luci.@command[-1].command="xs2184 -c" | ||
| last=8 | ||
| for i in $(seq 1 $last);do | ||
| uci add luci command | ||
| uci set luci.@command[-1].name="poe-lan$i-on" | ||
| uci set luci.@command[-1].command="xs2184 -u $last" | ||
| uci add luci command | ||
| uci set luci.@command[-1].name="poe-lan$i-off" | ||
| uci set luci.@command[-1].command="xs2184 -d $last" | ||
| last=$((last-1)) | ||
| done | ||
| uci commit luci | ||
| ``` | ||
This file contains hidden or 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,13 @@ | ||
| SRCS= \ | ||
| libxs2184/xs2184.c \ | ||
| libxs2184/i2cbusses.c | ||
|
|
||
| ifeq ($(CC),cc) | ||
| CC=${CROSS_COMPILE}gcc | ||
| endif | ||
|
|
||
| all: | ||
| ${CC} ${CFLAGS} -Wno-format-overflow -Wall -Werror -O1 -s ${SRCS} -o xs2184 ${LDFLAGS} -luci -lpthread -ldl | ||
|
|
||
| clean: | ||
| -rm -f *.o xs2184 |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Readme should be in English.