'프로그램 사용'에 해당되는 글 2354건

  1. 2022.02.25 libvncserver 마우스 이벤트
  2. 2022.02.23 uinput absolute mouse
  3. 2022.02.21 xmodmap
  4. 2022.02.21 uinput
  5. 2022.02.17 wayvnc 실행 실패
  6. 2022.02.16 wayland-scanner
  7. 2022.02.15 libvncserver 사용예
  8. 2022.02.14 lvm as ssd cache
  9. 2022.02.07 wayland wl_fixed_t 변수
  10. 2022.02.07 static link
프로그램 사용/VNC2022. 2. 25. 12:18

client -> server 프로토콜

#define rfbKeyEvent 4
#define rfbPointerEvent 5

 

키보드 이벤트 관련 구조체

/*-----------------------------------------------------------------------------
 * KeyEvent - key press or release
 *
 * Keys are specified using the "keysym" values defined by the X Window System.
 * For most ordinary keys, the keysym is the same as the corresponding ASCII
 * value.  Other common keys are:
 *
 * BackSpace 0xff08
 * Tab 0xff09
 * Return or Enter 0xff0d
 * Escape 0xff1b
 * Insert 0xff63
 * Delete 0xffff
 * Home 0xff50
 * End 0xff57
 * Page Up 0xff55
 * Page Down 0xff56
 * Left 0xff51
 * Up 0xff52
 * Right 0xff53
 * Down 0xff54
 * F1 0xffbe
 * F2 0xffbf
 * ... ...
 * F12 0xffc9
 * Shift 0xffe1
 * Control 0xffe3
 * Meta 0xffe7
 * Alt 0xffe9
 */

typedef struct {
    uint8_t type; /* always rfbKeyEvent */
    uint8_t down; /* true if down (press), false if up */
    uint16_t pad;
    uint32_t key; /* key is specified as an X keysym */
} rfbKeyEventMsg;

#define sz_rfbKeyEventMsg 8


typedef struct {
    uint8_t type;     /* always rfbQemuEvent */
    uint8_t subtype;  /* always 0 */
    uint16_t down;
    uint32_t keysym;  /* keysym is specified as an X keysym, may be 0 */
    uint32_t keycode; /* keycode is specified as XT key code */
} rfbQemuExtendedKeyEventMsg;

#define sz_rfbQemuExtendedKeyEventMsg 12

 

내용이 부실한데 드래그를 구현하려면 down 이벤트를 보고 해당 버튼의 마스크가 사라질때 까지 보고 있어야 할 듯?

uinput에서 그럼 드래그 어떻게 구현해야 하냐... ㅠㅠ

/*-----------------------------------------------------------------------------
 * PointerEvent - mouse/pen move and/or button press.
 */

typedef struct {
    uint8_t type; /* always rfbPointerEvent */
    uint8_t buttonMask; /* bits 0-7 are buttons 1-8, 0=up, 1=down */
    uint16_t x;
    uint16_t y;
} rfbPointerEventMsg;

#define rfbButton1Mask 1
#define rfbButton2Mask 2
#define rfbButton3Mask 4
#define rfbButton4Mask 8
#define rfbButton5Mask 16
/* RealVNC 335 method */
#define rfbWheelUpMask rfbButton4Mask
#define rfbWheelDownMask rfbButton5Mask

#define sz_rfbPointerEventMsg 6

[링크 : https://github.com/LibVNC/libvncserver/blob/master/rfb/rfbproto.h]

 

키보드의 경우 키 다운, 업 이벤트가 오는 것 같고, 반복키 처리를 좀 찾아봐야 할 듯.

마우스는 buttonmask에 

static void doptr(int buttonMask, int x, int y, rfbClientPtr cl)
{

}

static void dokey(rfbBool down, rfbKeySym key, rfbClientPtr cl)
{

}

[링크 : http:// https://github.com/LibVNC/libvncserver/blob/master/examples/example.c]

 

키보드 입력관련 선언문

#define XK_VoidSymbol 0xFFFFFF /* void symbol */

#define XK_BackSpace 0xFF08 /* back space, back char */
#define XK_Tab 0xFF09
#define XK_Linefeed 0xFF0A /* Linefeed, LF */
#define XK_Clear 0xFF0B
#define XK_Return 0xFF0D /* Return, enter */
#define XK_Pause 0xFF13 /* Pause, hold */
#define XK_Scroll_Lock 0xFF14
#define XK_Sys_Req 0xFF15
#define XK_Escape 0xFF1B
#define XK_Delete 0xFFFF /* Delete, rubout */

#define XK_A                   0x041
#define XK_B                   0x042
#define XK_C                   0x043

#define XK_a                   0x061
#define XK_b                   0x062
#define XK_c                   0x063

[링크 : https://github.com/LibVNC/libvncserver/blob/master/rfb/keysym.h]

 

[링크 : https://github.com/LibVNC/libvncserver]

 

+

relative / absolute mode 관련 참고할 코드

doptr() 에서 현재 좌표 넘어온 것과 이전 마지막 좌표 계산해서 넣는것 외에는

libvncserver 자체에서 상대좌표 모드로 작동하진 않도록 구성되어 있는 것으로 보인다.

[링크 : https://github.com/hanzelpeter/dispmanx_vnc/blob/master/main.c]

Posted by 구차니
프로그램 사용/uinput2022. 2. 23. 14:55

 

[링크 : https://www.kernel.org/doc/Documentation/input/event-codes.txt]

[링크 : https://stackoverflow.com/questions/5190921/simulating-absolute-mouse-movements-in-linux-using-uinput]

 

+

2022.02.25

 

// uinput.h
#define UI_SET_EVBIT _IOW(UINPUT_IOCTL_BASE, 100, int)
#define UI_SET_KEYBIT _IOW(UINPUT_IOCTL_BASE, 101, int)
#define UI_SET_RELBIT _IOW(UINPUT_IOCTL_BASE, 102, int)
#define UI_SET_ABSBIT _IOW(UINPUT_IOCTL_BASE, 103, int)

#define UI_DEV_CREATE _IO(UINPUT_IOCTL_BASE, 1)
#define UI_DEV_DESTROY _IO(UINPUT_IOCTL_BASE, 2)
#define UI_DEV_SETUP _IOW(UINPUT_IOCTL_BASE, 3, struct uinput_setup)

// input-event-codes.h
#define EV_KEY 0x01
#define EV_REL 0x02
#define EV_ABS 0x03

#define REL_X 0x00
#define REL_Y 0x01

#define ABS_X 0x00
#define ABS_Y 0x01

[링크 : https://github.com/aosp-mirror/platform_bionic/blob/master/libc/kernel/uapi/linux/input-event-codes.h]

[링크 : https://github.com/torvalds/linux/blob/master/include/uapi/linux/uinput.h]

[링크 : https://github.com/nmelihsensoy/virtual-hid-tcp/blob/master/server/src/server.c]

'프로그램 사용 > uinput' 카테고리의 다른 글

uinput 터치 스크린 예제  (0) 2022.08.05
evbug - 키보드/마우스 입력 디버깅 하기  (0) 2022.08.05
uinput 장치 확인  (0) 2022.03.04
xmodmap  (0) 2022.02.21
uinput  (0) 2022.02.21
Posted by 구차니
프로그램 사용/uinput2022. 2. 21. 15:43

키코드 확인하는 명령어

여전..히 키코드와 키입력은 헷갈리네

 

$ xmodmap -pke
keycode   8 = Mode_switch NoSymbol Mode_switch
keycode   9 = Escape NoSymbol Escape
keycode  10 = 1 exclam 1 exclam
keycode  11 = 2 at 2 at
keycode  12 = 3 numbersign 3 numbersign
keycode  13 = 4 dollar 4 dollar
keycode  14 = 5 percent 5 percent
keycode  15 = 6 asciicircum 6 asciicircum
keycode  16 = 7 ampersand 7 ampersand
keycode  17 = 8 asterisk 8 asterisk
keycode  18 = 9 parenleft 9 parenleft
keycode  19 = 0 parenright 0 parenright
keycode  20 = minus underscore minus underscore
keycode  21 = equal plus equal plus
keycode  22 = BackSpace BackSpace BackSpace BackSpace
keycode  23 = Tab ISO_Left_Tab Tab ISO_Left_Tab
keycode  24 = q Q q Q
keycode  25 = w W w W
keycode  26 = e E e E
keycode  27 = r R r R
keycode  28 = t T t T
keycode  29 = y Y y Y
keycode  30 = u U u U
keycode  31 = i I i I
keycode  32 = o O o O
keycode  33 = p P p P

[링크 : https://forums.raspberrypi.com/viewtopic.php?t=21804]

'프로그램 사용 > uinput' 카테고리의 다른 글

uinput 터치 스크린 예제  (0) 2022.08.05
evbug - 키보드/마우스 입력 디버깅 하기  (0) 2022.08.05
uinput 장치 확인  (0) 2022.03.04
uinput absolute mouse  (0) 2022.02.23
uinput  (0) 2022.02.21
Posted by 구차니
프로그램 사용/uinput2022. 2. 21. 14:57

잘 되려나..

 

라즈베리에서 해당 디바이스가 root:root 라서 server를 root 권한으로 돌려야 한다.

$ ls -al /dev/uinput
crw------- 1 root root 10, 223 Jan 27 11:33 /dev/uinput

[링크 : https://01.org/linuxgraphics/gfx-docs/drm/input/uinput.html]

[링크 : https://github.com/nmelihsensoy/virtual-hid-tcp]

 

/usr/include/linux/input-event-codes.h 에서 KEY_로 시작하는 선언들 발견

 

+

2022.02.23

[링크 : https://www.freedesktop.org/software/libevdev/doc/latest/]

'프로그램 사용 > uinput' 카테고리의 다른 글

uinput 터치 스크린 예제  (0) 2022.08.05
evbug - 키보드/마우스 입력 디버깅 하기  (0) 2022.08.05
uinput 장치 확인  (0) 2022.03.04
uinput absolute mouse  (0) 2022.02.23
xmodmap  (0) 2022.02.21
Posted by 구차니
프로그램 사용/wayland2022. 2. 17. 12:04

weston 에서 억지로 빌드해서 돌렸더니 에러 똬닥!

# ./wayvnc
wl_registry@2: error 0: invalid version for global zxdg_output_manager_v1 (4): have 2, wanted 3
ERROR: Virtual Pointer protocol not supported by compositor.
ERROR: Failed to initialise wayland

 

이제 보니.. wlroots 기반의 wayland compositor에서 돌아가는 녀석이었군..

About
A VNC server for wlroots based Wayland compositors

[링크 : https://github.com/any1/wayvnc]

 

freedesktop.org 에서 관리하는 녀석

[링크 : https://gitlab.freedesktop.org/wlroots/wlroots/]

[링크 : https://github.com/swaywm/wlroots]

'프로그램 사용 > wayland' 카테고리의 다른 글

weston debug message  (0) 2022.03.18
weston drm atomic  (0) 2022.03.17
wayland-scanner  (0) 2022.02.16
wayland wl_fixed_t 변수  (0) 2022.02.07
wayvnc  (0) 2022.01.24
Posted by 구차니
프로그램 사용/wayland2022. 2. 16. 14:09

동일 이름의 xml 파일은 보이는데 헤더나 소스가 없어서

build 관련 스크립트를 뒤져보다 보니 빙고

./wayvnc/build/build.ninja:205:build protocols/libclient_protos.a.p/wlr-virtual-pointer-unstable-v1.h: CUSTOM_COMMAND ../protocols/wlr-virtual-pointer-unstable-v1.xml | /opt/toolchain/usr/bin/wayland-scanner

 

This tool is used to generate C headers & glue code from the Wayland protocol XML files discussed in chapter 2.3

[링크 : https://wayland-book.com/libwayland/wayland-scanner.html]

[링크 : https://makersweb.net/linux/18842]

'프로그램 사용 > wayland' 카테고리의 다른 글

weston drm atomic  (0) 2022.03.17
wayvnc 실행 실패  (0) 2022.02.17
wayland wl_fixed_t 변수  (0) 2022.02.07
wayvnc  (0) 2022.01.24
weston client 메모리 누수  (0) 2022.01.17
Posted by 구차니
프로그램 사용/VNC2022. 2. 15. 16:33

-lvncserver 해주고 나면 의외로 건드릴게 별로 없다.

 

#include <rfb/rfb.h>

int main(int argc,char** argv)
{                                                                
  rfbScreenInfoPtr server=rfbGetScreen(&argc,argv,400,300,8,3,4);
  if(!server)
    return 1;
  server->frameBuffer=(char*)malloc(400*300*4);
  rfbInitServer(server);           
  rfbRunEventLoop(server,-1,FALSE);
  return(0);
}

[링크 : https://github.com/LibVNC/libvncserver/blob/master/examples/simple.c]

'프로그램 사용 > VNC' 카테고리의 다른 글

libvncserver websocket example  (0) 2022.08.12
libvncserver 마우스 이벤트  (0) 2022.02.25
rfb(remote framebuffer) protocol  (0) 2022.01.26
gconf-editor / ubuntu 14.04 LTS vino + VNC 접속불가  (0) 2015.03.22
VNC web 버전?  (0) 2014.12.11
Posted by 구차니
프로그램 사용/LVM2022. 2. 14. 14:15

SSD + HDD로 구성해서 write back cache를 SSD에 적용가능하다고 들었는데

mdadm에서 하는게 아니라 lvm 에서 설정이 가능하다고 해서 검색

 

lvm 관련 명령어를 이용해 nvme/ssd 등을 생성하고

volume group에 묶고 해당 vg를 cachepool 로 등록하는 걸로 되는 것 같긴하다.

# pvcreate /dev/sda
# pvcreate /dev/nvme0n1
# pvcreate /dev/nvme1n1
# vgcreate vg_data1 /dev/sda /dev/nvme0n1 /dev/nvme1n1
# lvcreate -l 19071823 -n lv_data1 vg_data1 /dev/sda
# lvcreate -i2 -L 16G -n lv_cache_meta1 vg_data1 /dev/nvme0n1 /dev/nvme1n1
# lvcreate -i2 -I2048 -l 100%FREE -n lv_cache1 vg_data1 /dev/nvme0n1 /dev/nvme1n1
# lvconvert --type cache-pool /dev/vg_data1/lv_cache1 --poolmetadata /dev/vg_data1/lv_cache_meta1 --chunksize 2048
# lvconvert --type cache /dev/vg_data1/lv_data1 --cachepool /dev/vg_data1/lv_cache1
# dmsetup status

[링크 : https://umount.net/ssd-caching-dm-cache-setting/]

[링크 : https://jabriffa.wordpress.com/2019/08/23/using-a-ssd-to-cache-data-volume-on-ubuntu-18-04-lts/]

[링크 : https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/logical_volume_manager_administration/lvm_cache_volume_creation]

 

'프로그램 사용 > LVM' 카테고리의 다른 글

LVM 관리  (0) 2019.03.05
애증의.. LVM? centos 기본값 설치에서 변형했더니...  (0) 2019.03.05
lvm raid  (0) 2019.01.15
LVM - Logical Volumegroup Management  (0) 2009.01.22
Posted by 구차니

23bit 비트의 정수고 8bit의 십진수 정확도 라고 하니 먼가 감이 안오는데

 

0 ~ 8388608(2^23) 범위를

0  ~ 32768 로 사용한다는 것. (그럼 이론상 FHD 17*17개 UHD 8*8 까지 가능하려나)

 

정확도는 어떤 의미로 쓰려나.. 나중에 확대했을때를 대비해서 소수점 포인트를 주는건가?

 

/**
 * Fixed-point number
 *
 * A `wl_fixed_t` is a 24.8 signed fixed-point number with a sign bit, 23 bits
 * of integer precision and 8 bits of decimal precision. Consider `wl_fixed_t`
 * as an opaque struct with methods that facilitate conversion to and from
 * `double` and `int` types.
 */
typedef int32_t wl_fixed_t;

[링크 : https://code.woboq.org/qt5/include/wayland-util.h.html]

 

typedef int32_t wl_fixed_t;

static inline int wl_fixed_to_int(wl_fixed_t f)
{
    return f / 256;
}

static inline wl_fixed_t wl_fixed_from_int(int i)
{
    return i * 256;
}

[링크 : https://github.com/nobled/wayland/blob/master/src/wayland-util.h]

'프로그램 사용 > wayland' 카테고리의 다른 글

wayvnc 실행 실패  (0) 2022.02.17
wayland-scanner  (0) 2022.02.16
wayvnc  (0) 2022.01.24
weston client 메모리 누수  (0) 2022.01.17
wayland buffer  (0) 2022.01.13
Posted by 구차니
프로그램 사용/gcc2022. 2. 7. 16:07

전부 정적으로 묶고 일부만 동적으로 묶는거나

동적으로 묶을건 냅두고 필요한(나머지) 것을 정적으로 묶는거나 그게 그건가?

 

-static-libgcc 한다고 해서 glibc 버전 안 맞다고 발생하는 에러를 해결할 순 없다

[링크 : https://stackoverflow.com/questions/26304531]

 

[링크 : https://kldp.org/node/136157]

  [링크 : https://enst.tistory.com/entry/liblibcso6-version-GLIBC27-not-found]

 

 

[링크 : https://gcc.gnu.org/onlinedocs/gcc/Link-Options.html]

  [링크 : https://www.codeproject.com/Questions/1241890/How-to-link-to-libc-statically]

 

-lm 버전 문제 있으면 걍 해당 라이브러리를 static link 해버리면 되니까!

$ g++ -std=c++11 -o classify classify.cc -I/home/pi/work/coral/libedgetpu/tflite/public -I/home/pi/work/coral/tensorflow -I/home/pi/work/coral/tensorflow/tensorflow/lite/tools/make/downloads/flatbuffers/include -L/home/pi/work/coral/tensorflow/tensorflow/lite/tools/make/gen/rpi_armv7l/lib -L/home/pi/work/coral/pycoral/libedgetpu_bin/throttled/armv7a -ltensorflow-lite -static-libgcc -l:libedgetpu.so.1.0 -lpthread -ldl /usr/lib/arm-linux-gnueabihf/libm.a

[링크 : http://www.iamroot.org/xe/index.php?mid=Programming&document_srl=13406]

'프로그램 사용 > gcc' 카테고리의 다른 글

gcc vectorization 실패  (0) 2022.06.02
gcc / 문자열 선언  (0) 2022.03.17
구조체 타입과 변수명은 구분된다?  (0) 2021.11.18
gcc unsigned to signed upcast 테스트  (0) 2021.07.08
gcc vectorized loop  (0) 2021.06.30
Posted by 구차니