星期二, 5月 20, 2025

net snmp

 /etc/snmp/snmpd.conf

rocommunity public

agentAddress udp:161

pass .1.3.6.1.4.1.55554 /bin/bash /snmp.sh



 /snmp.sh
#!/bin/bash

opt=$1
oid=$2

echo "$(date) - called with opt=$opt oid=$oid" >> /tmp/snmp_script.log

if [ "$opt" = "-g" ]; then
  case "$oid" in
    ".1.3.6.1.4.1.55554.1.1.0")
      echo "$oid"
      echo "INTEGER"
      echo "1"
      ;;
    ".1.3.6.1.4.1.55554.1.2.0")
      echo "$oid"
      echo "STRING"
      echo "IPCamModelX"
      ;;
    *)
      exit 1
      ;;
  esac

elif [ "$opt" = "-n" ]; then
  # 簡單示範,回傳下一個 OID
  if [ "$oid" = ".1.3.6.1.4.1.55554.1.1.0" ]; then
    echo ".1.3.6.1.4.1.55554.1.2.0"
    echo "STRING"
    echo "IPCamModelX"
  else
    exit 1
  fi

elif [ "$opt" = "-s" ]; then
  # 如果要支援 set,這邊寫set邏輯
  exit 1

else
  exit 1
fi

Agent

 /usr/sbin/snmpd -V -f -Lo -C -c /etc/snmp/snmpd.conf -Dpass,persist,mib_modules


Client
snmpwalk -v2c -c public localhost .1.3.6.1.4.1.55554.1.1.0


Output
iso.3.6.1.4.1.55554.1.1.0 = INTEGER: 1


星期五, 5月 16, 2025

Pure RTSP over Websocket Player build in browser

 https://anzal.hashnode.dev/a-beginners-guide-to-rtsp-streaming-with-websockets-using-nodejs-and-ffmpeg

A Beginner’s Guide to RTSP Streaming with WebSockets Using Node.js and FFmpeg.



星期三, 4月 16, 2025

内存泄漏定位工具之 valgrind

 https://blog.csdn.net/weixin_45631738/article/details/129541098?utm_medium=distribute.pc_relevant.none-task-blog-2~default~baidujs_baidulandingword~default-1-129541098-blog-124682490.235^v43^pc_blog_bottom_relevance_base8&spm=1001.2101.3001.4242.2&utm_relevant_index=4



星期一, 1月 20, 2025

libevent timer

https://www.cnblogs.com/osbreak/p/17823102.html

 #include <iostream>

#include <event2/event.h> #include <signal.h> using namespace std; void timer(int sockfd, short what, void* arg) { cout << "[timer2]" << endl; } int main(int argc, char* argv[]) { event_base* base = event_base_new(); // 持久事件 event *ev = event_new(base,-1,EV_PERSIST,timer,0); //超时优化性能优化,默认event 用二叉堆存储(完全二叉树) 插入删除O(logn) //优化到双向队列 插入删除O(1) static timeval tv_in = {3,0}; const timeval *t; t = event_base_init_common_timeout(base,&tv_in); event_add(ev3,t3); // 性能优化:插入性能 O(1) // 进入事件主循环 event_base_dispatch(base); event_base_free(base); return 0; }

星期一, 1月 06, 2025

valgrind compilation

 https://blog.csdn.net/HZHejo/article/details/124682490


Check libraries dependence

 

Ref: https://albert-oma.blogspot.com/

check libraries dependence:

$ arm-linux-gnueabihf-readelf -d ./gst-launch-1.0


星期三, 12月 11, 2024

Virtual memory related


 Linux内存管理之vmap与vmalloc 圖文並茂 , 針對vmap_area

mmap system call 後, 進kernel 的流程 gitmind 自畫

https://elixir.free-electrons.com/linux/v5.10.230/source/mm/util.c 方便追code, 含各版本

AArch64 Linux memory layout



星期一, 12月 09, 2024

用 LD_PRELOAD 替換動態連結的函式庫

用 LD_PRELOAD 替換動態連結的函式庫

https://jasonblog.github.io/note/fcamel/04.html

星期一, 11月 25, 2024

TFAT


Power Fail Safe FAT File System
https://elinux.org/images/5/54/Elc2011_munegowda.pdf 


TI-LFAT and TI-LExFAT :
https://www.researchgate.net/publication/271722839_Design_and_Implementation_of_Log_Structured_FAT_and_ExFAT_File_Systems


KFAT:
https://www.researchgate.net/publication/344581895_KFAT_LOG-BASED_TRANSACTIONAL_FAT_FILESYSTEM_FOR_EMBEDDED_MOBILE_SYSTEMS

TFS4:
  1. https://elinux.org/images/5/54/Elc2011_munegowda.pdf
  2. https://bitsavers.computerhistory.org/components/samsung/flash/TFS4_v1.5.0_Porting_Guide_20060502.pdf




ExFAT

  1. https://events.static.linuxfound.org/images/stories/pdf/lceu11_munegowda_s.pdf





Renesas:. (not Transaction)
TFAT V.4.02 (FatFs R0.13c) for RX family allows to the format feature for SD memory card and USB memory in addition to eMMC and Serial Flash memory.
  1.  https://www.renesas.com/en/document/apn/rx-family-open-source-fat-file-system-m3s-tfat-tiny-module-using-firmware-integration-technology?language=en&srsltid=AfmBOootRvzRHDCmHPSjqznUcYY8yXmaEfAfhSOP7xiem1jOCZ-Jukhm
  2. https://www.renesas.com/en/software-tool/fat-file-system-m3s-tfat-tiny-rx-family#overview