BV1AL 之無所不記

2018-08-25

Port 80h LED 的小工具

如果要檢測 server上的 Port 80 LED, 可以找這個
https://pypi.org/project/portio/

可以不用pip 來安裝, 直接compile so來用也可以, 攜帶方便。

tar zxvf portio-0.5.tar.gz
cd portio-0.5

gcc -I/usr/include/python2.7 -c -fPIC portio.c -o portio.o
(或是 -I/usr/include/python3.6)
(-fPIC Position Independent Code)

(接下來從 .o 來產出 .so)
gcc -shared -o portio.so portio.o

使用時可以把 .so 放在 .py 同一目錄即可,不必install
----程式start
import portio
portio.ioperm(0x80, 3, 1) #先打開
# N 可以從 0 到 255, 0是全滅, 255是全亮
portio.outb(N, 0x80)
portio.ioperm(0x80, 3, 0) #關閉
----程式end

標籤: ,