J 창고

[D-Bus] D-Feet with socat for remote device 본문

컴퓨터/Linux

[D-Bus] D-Feet with socat for remote device

JSFamily 2020. 6. 26. 22:44

 

1. 개요

Linux의 경우 D-Bus라는 IPC를 많이 사용하는 것을 볼 수 있는데 이를 확인하기 위한 수단으로는 간단하게는 dbus-monitor라는 CLI Tool이 있으며 GUI로는 D-Feet이라는 Tool이 있다.
다만 최근 Embedded Device에서도 D-Bus를 IPC로 자주 사용하는 경우를 볼 수 있으며 이를 Debug 하기 위한 수단으로는 dbus-monitor를 주로 사용했다.
그렇지만 사람은 GUI가 아무래도 편할 것이고.... 이래저래 검색을 해 본 결과론 Linux 배포판에서 사용하던 D-Feet을Remote Device의 D-Bus를 가져와서 Display할 수 있는 방법을 찾아 공유해 본다.

본 포스트는 system d-bus를 예로 들었으며 session d-bus는 더 쉽게 설정할 수 있다.

 

2. 사용법

2-1. excute socat in target side

~$ socat TCP-LISTEN:7272,reuseaddr,fork UNIX-CONNECT:/var/run/dbus/sytem_dbus_socket


ps. session d-bus의 경우 /tmp/session-dbus 에 socket file이 존재하므로 아래와 같이 하면 된다.

~$ socat TCP-LISTEN:7272,reuseaddr,fork UNIX-CONNECT:/tmp/session-bus

 

2-2. create dbus file in host side

~$ touch /tmp/dbus

 

2-3. excute socat in host side

~$ sudo socat ABSTRACT-LISTEN:/tmp/dbus,fork TCP:192.168.0.4:7272

 

2-4. excute d-feet with sudo

~$ sudo d-feet

 

2-5. connect other bus

unix:abstract=/tmp/dbus

 

2-6. Now, you can see system d-bus list of target

 

3. dbus-monitor with socat

3-1. Socat from Target side

2-1과 동일

3-2. Host side

sudo DBUS_SESSION_BUS_ADDRESS=tcp:host=192.168.10.2,port=7272 dbus-monitor --session

4. Reference

https://stackoverflow.com/questions/10158684/connecting-to-dbus-over-tcp

https://serverfault.com/questions/414350/access-d-bus-remotely-using-socat

Comments