gklib, gkapi and k3sysui communicate mainly via UNIX domain sockets and TCP.
Intercept gklib IO (can use gkapi or K3SysUi PID instead, or all three together):
strace -z -Y -y -f -e trace=read,write -e signal=none --strings-in-hex=non-ascii-chars -s 1000 -p <pid-of-gklib>
Intercept socket API:
2>&1 | grep 'socket:'
Intercept serial comms:
2>&1 | grep '/dev/tty'
The socket used by gklib (/tmp/unix_uds1
) implements a limited Klipper API. In addition it supports the following commands:
{"method":"objects/query","params":{"objects":{"filament_hub":null}},"id":30}\\\\x03
response:
{"id":30,"result":{"eventtime":10406.219115208,"status":{"filament_hub":{"auto_refill":0,"current_filament":"","cutter_state":0,"ext_spool":0,"ext_spool_status":"ready","filament_hubs":[{"id":0,"status":"ready","dryer_status":{"status":"stop","target_temp":0,"duration":0,"remain_time":0},"temp":45,"slots":[{"index":0,"status":"ready","sku":"","type":"PLA","color":[158,166,180],"rfid":1,"source":2},{"index":1,"status":"ready","sku":"","type":"PLA","color":[255,255,255],"rfid":1,"source":2},{"index":2,"status":"empty","sku":"","type":"","color":[0,0,0],"source":3},{"index":3,"status":"empty","sku":"","type":"","color":[0,0,0],"source":3}]}],"statistics":{"unwind_stat":[0,0,0,0,0],"feed_stat":[29,0,0,0,0]}}}}}\\\\x03
{"method":"filament_hub/set_config","params":{"auto_refill":1},"id":31}\\\\x03
response:
{"id":31,"result":{}}\\\\x03