'Linux API'에 해당되는 글 147건

  1. 2026.11.08 uvc 카메라 대역폭 관련
  2. 2026.10.26 MALLOC_ARENA_MAX
  3. 2026.09.09 openpty, forkpty, login_tty
  4. 2026.04.06 kernel driver
  5. 2026.04.03 커널 cmdline 관련 함수
  6. 2025.12.23 kernel input_event() 1
  7. 2025.12.22 tcp keepalive
  8. 2025.10.11 linux 시리얼 포트 열기(termios)
  9. 2025.06.02 LD_DEBUG=libs
  10. 2024.12.04 linux device tree(dtb) 문법...?
Linux API/usb2026. 11. 8. 23:16

gpt랑 대화하다가 검토중

uvc 카메라 두개를 하나의 root hub에 연결하면 대역폭 부족으로 하나가 인식이 안되는데

잘못된 보고를 하는 uvc 카메라의 경우(모든 장비가  bug-free가 아니니까 라고 표현)

이러한 것을 위해 드라이버 레벨에서 새롭게 대역폭을 계산해서 적용하도록 할 수 있는 옵션을 제공하나 보다.

다만 yuv 같은 경우처럼 고정된 크기라면 모를까  mjpeg 처럼 크기가 가변인건 안된다고 하는데

그럼.. h.264 cbr 의 경우는 ... 되는건가 싶었는데 압축 포맷이면 건너 뛴다고..

if (!(format->flags & UVC_FMT_FLAG_COMPRESSED) &&
    stream->dev->quirks & UVC_QUIRK_FIX_BANDWIDTH &&
    stream->intf->num_altsetting > 1) {

[링크 : https://github.com/torvalds/linux/blob/master/drivers/media/usb/uvc/uvc_video.c#L230]

 

나중에 한번 시도 할 만한 장비가 있으려나?

sudo modprobe -r uvcvideo
sudo modprobe uvcvideo quirks=0x80

 

What are quirks and how do I use them?
Not all UVC devices are bug-free. To be fair, most UVC devices are buggy, and some of them are so broken that they will not work with the uvcvideo driver out of the box. They should not have been labelled as UVC-compliant or even been sold, but the harm is done and we need to find a way to cope with it. That's why quirks have been introduced.

When a quasi-UVC device exhibits a UVC non-compliance (either because its developers have interpreted the UVC specification incorrectly, or because they forgot to implement parts of the specification that are not used by the Windows driver), the uvcvideo driver needs to handle that device in a special way. The driver tries to do detect those cases automatically, but needs to be explictly instructed on some cases. Each of those special cases is called a quirk and is identified by a flag.

UVC_QUIRK_FIX_BANDWIDTH 0x00000080 Try to estimate the bandwidth required for uncompressed streams instead on relying on the value reported by the camera. See FAQ 7 for more information.

[링크 : https://ideasonboard.org/uvc/faq/]

 

'Linux API > usb' 카테고리의 다른 글

usbfs / usb api  (0) 2012.02.04
/proc/bus/usb 의 내용이 없을 경우(There is no files /proc/bus/usb)  (0) 2009.06.08
usb 버스 정보 얻기  (0) 2009.06.08
Posted by 구차니
Linux API/linux2026. 10. 26. 15:06

대충 정리하면 멀티쓰레드를 위해서

코어 갯수 만큼의 arena 라는 메모리 영역을 미리 나누고, 할당 받아 RSS를 소모하면서 효율을 올리는 듯.

반대로 이걸 1로 설정하면 메모리 영역을 나누지 않는건데. malloc 락에서 성능이 저하시킬 우려가 존재는 함.

[링크 : https://kjhoon0330.tistory.com/entry/MALLOCARENAMAX-옵션을-알기-위한-여정-정리]

 

musl libc는 glibc와 달라서 얘로 쓸경우에는 영향을 미치지 못한다고 한다.

[링크 : https://ko.wikipedia.org/wiki/Musl]

[링크 : https://musl.libc.org/]

'Linux API > linux' 카테고리의 다른 글

openpty, forkpty, login_tty  (0) 2026.09.09
kernel driver  (0) 2026.04.06
커널 cmdline 관련 함수  (0) 2026.04.03
kernel input_event()  (1) 2025.12.23
linux 시리얼 포트 열기(termios)  (0) 2025.10.11
Posted by 구차니
Linux API/linux2026. 9. 9. 17:17

gpt 말로는 scanf() 같이 터미널에서 입력 받는 등, pipe 보다는 터미널의 영향을 받는 프로그램을 테스트 하기 좋다고. 

forkpty는 fork + openpty 라는데 한번 둘러는 봐야겠다.

 

The openpty() function finds an available pseudoterminal and returns file descriptors for the master and slave in amaster and aslave. If name is not NULL, the filename of the slave is returned in name. If termp is not NULL, the terminal parameters of the slave will be set to the values in termp. If winp is not NULL, the window size of the slave will be set to the values in winp.
The login_tty() function prepares for a login on the terminal fd (which may be a real terminal device, or the slave of a pseudoterminal as returned by openpty()) by creating a new session, making fd the controlling terminal for the calling process, setting fd to be the standard input, output, and error streams of the current process, and closing fd.

The forkpty() function combines openpty(), fork(2), and login_tty() to create a new process operating in a pseudoterminal. The file descriptor of the master side of the pseudoterminal is returned in amaster, and the filename of the slave in name if it is not NULL. The termp and winp arguments, if not NULL, will determine the terminal attributes and window size of the slave side of the pseudoterminal.

[링크 : https://linux.die.net/man/3/openpty]

[링크 : https://linux.die.net/man/3/forkpty]

'Linux API > linux' 카테고리의 다른 글

MALLOC_ARENA_MAX  (0) 2026.10.26
kernel driver  (0) 2026.04.06
커널 cmdline 관련 함수  (0) 2026.04.03
kernel input_event()  (1) 2025.12.23
linux 시리얼 포트 열기(termios)  (0) 2025.10.11
Posted by 구차니
Linux API/linux2026. 4. 6. 16:14

hid multitouch 드라이버 보다가 신기한(?)거 발견

간단하게(?)  /sys 경로에 show_mt 라는 파일이 생성되고 boolean 타입으로 내용을 써주면 드라이버에서

그 값을 이용해 작동하게 되는 매크로.

 

module_param(show_mt, bool, 0444);

[링크 : https://github.com/bentiss/hid-multitouch/blob/master/hid-multitouch.c]

 

[링크 :https://reakwon.tistory.com/226]

'Linux API > linux' 카테고리의 다른 글

MALLOC_ARENA_MAX  (0) 2026.10.26
openpty, forkpty, login_tty  (0) 2026.09.09
커널 cmdline 관련 함수  (0) 2026.04.03
kernel input_event()  (1) 2025.12.23
linux 시리얼 포트 열기(termios)  (0) 2025.10.11
Posted by 구차니
Linux API/linux2026. 4. 3. 12:06

 

22.5 cmdline_find_option()
command line에서 option을 파싱하는 함수다.

이 함수는 __cmdline_find_option()를 호출한다. booting시의 함수라면 cmdline의 위치가 1M 위쪽에 있으면 찾지않고 리턴한다.

[링크 : https://www.iamroot.org/ldocs/linux.html#sec-22-5]

'Linux API > linux' 카테고리의 다른 글

openpty, forkpty, login_tty  (0) 2026.09.09
kernel driver  (0) 2026.04.06
kernel input_event()  (1) 2025.12.23
linux 시리얼 포트 열기(termios)  (0) 2025.10.11
LD_DEBUG=libs  (0) 2025.06.02
Posted by 구차니
Linux API/linux2025. 12. 23. 10:52

먼가 uinput 에서 사용하던 함수 같은 느낌의 코드가 보여서 찾아보는 중

input_event(input, EV_ABS, ABS_MT_POSITION_X, *slot->x);
input_event(input, EV_ABS, ABS_MT_POSITION_Y, *slot->y);
input_event(input, EV_ABS, ABS_MT_TOOL_X, *slot->cx);
input_event(input, EV_ABS, ABS_MT_TOOL_Y, *slot->cy);
input_event(input, EV_ABS, ABS_MT_DISTANCE, !*slot->tip_state);
input_event(input, EV_ABS, ABS_MT_ORIENTATION, orientation);
input_event(input, EV_ABS, ABS_MT_PRESSURE, *slot->p);
input_event(input, EV_ABS, ABS_MT_TOUCH_MAJOR, major);
input_event(input, EV_ABS, ABS_MT_TOUCH_MINOR, minor);

 

void input_event(struct input_dev * dev, unsigned int type, unsigned int code, int value)
report new input event

Parameters

struct input_dev * devdevice that generated the eventunsigned int typetype of the eventunsigned int codeevent codeint valuevalue of the event

Description
This function should be used by drivers implementing various input devices to report input events. See also input_inject_event().

NOTE

input_event() may be safely used right after input device was allocated with input_allocate_device(), even before it is registered with input_register_device(), but the event will not reach any of the input handlers. Such early invocation of input_event() may be used to ‘seed’ initial state of a switch or initial position of absolute axis, etc.

[링크 : https://www.kernel.org/doc/html/v4.14/driver-api/input.html#c.input_event]

'Linux API > linux' 카테고리의 다른 글

kernel driver  (0) 2026.04.06
커널 cmdline 관련 함수  (0) 2026.04.03
linux 시리얼 포트 열기(termios)  (0) 2025.10.11
LD_DEBUG=libs  (0) 2025.06.02
linux device tree(dtb) 문법...?  (0) 2024.12.04
Posted by 구차니
Linux API/network2025. 12. 22. 12:09

'Linux API > network' 카테고리의 다른 글

bind(): Address already in use  (0) 2023.07.21
recv 와 read 차이  (0) 2023.06.23
AF_PACKET로 link layer 열기  (0) 2022.06.09
linux tcp server listen accept connect  (0) 2022.05.11
ssl socket 예제  (0) 2022.03.25
Posted by 구차니
Linux API/linux2025. 10. 11. 21:23

이렇게 상세하게 정리된 건 첨보는 듯.

 

[링크 : https://laboratorium.tistory.com/24]

'Linux API > linux' 카테고리의 다른 글

커널 cmdline 관련 함수  (0) 2026.04.03
kernel input_event()  (1) 2025.12.23
LD_DEBUG=libs  (0) 2025.06.02
linux device tree(dtb) 문법...?  (0) 2024.12.04
usb hid, hidraw  (0) 2024.03.11
Posted by 구차니
Linux API/linux2025. 6. 2. 18:03

리눅스에서 공유 라이브러리(so) 호출시 경로등을 확인하기 용이한 디버깅 변수

 

LD_DEBUG=help cat
Valid options for the LD_DEBUG environment variable are:

  libs        display library search paths
  reloc       display relocation processing
  files       display progress for input file
  symbols     display symbol table processing
  bindings    display information about symbol binding
  versions    display version dependencies
  all         all previous options combined
  statistics  display relocation statistics
  unused      determined unused DSOs
  help        display this help message and exit

To direct the debugging output into a file instead of standard output
a filename can be specified using the LD_DEBUG_OUTPUT environment
variable.

[링크 : https://bnikolic.co.uk/blog/linux-ld-debug.html]

'Linux API > linux' 카테고리의 다른 글

kernel input_event()  (1) 2025.12.23
linux 시리얼 포트 열기(termios)  (0) 2025.10.11
linux device tree(dtb) 문법...?  (0) 2024.12.04
usb hid, hidraw  (0) 2024.03.11
linux 멀티터치 프로토콜  (0) 2024.03.08
Posted by 구차니
Linux API/linux2024. 12. 4. 14:18

고통 받고 있는 ptn5110에 대해서 검색하는데

리눅스 소스상에 dtb로만 존재해서 문법을 찾아보는 중.

봐야할 부분은 source-pdos의 <PDO_FIXED()>; 인데

	ptn5110: tcpc@50 {
		compatible = "nxp,ptn5110", "tcpci";
		pinctrl-names = "default";
		pinctrl-0 = <&pinctrl_typec>;
		reg = <0x50>;
		interrupt-parent = <&lsio_gpio1>;
		interrupts = <3 IRQ_TYPE_LEVEL_LOW>;

		usb_con1: connector {
			compatible = "usb-c-connector";
			label = "USB-C";
			power-role = "source";
			data-role = "dual";
			source-pdos = <PDO_FIXED(5000, 3000, PDO_FIXED_USB_COMM)>;

			ports {
				#address-cells = <1>;
				#size-cells = <0>;

				port@0 {
					reg = <0>;

					typec_dr_sw: endpoint {
						remote-endpoint = <&usb3_drd_sw>;
					};
				};

				port@1 {
					reg = <1>;

					typec_con_ss: endpoint {
						remote-endpoint = <&usb3_data_ss>;
					};
				};
			};
		};
	};

 

<> 는 cell 이라고 부르고

[링크 : https://kernel.bz/boardPost/118684/3]

 

unsigned int로 된 배열인것 같은데

  • 텍스트 문자열 (널로 종료 됨)은 큰 따옴표로 표시됩니다.
    • string-property = "a string";
  • ‘셀’은 꺾쇠 괄호로 구분 된 32 비트 부호없는 정수입니다.
    • cell-property = <0xbeef 123 0xabcd1234>;
  • 이진 데이터는 대괄호로 구분됩니다.
    • binary-property = [0x01 0x23 0x45 0x67];
  • 다른 표현의 데이터는 쉼표를 사용하여 함께 연결할 수 있습니다.
    • mixed-property = "a string", [0x01 0x23 0x45 0x67], <0x12345678>;
  • 쉼표는 문자열 목록을 만드는 데에도 사용됩니다.
    • string-list = "red fish", "blue fish";

[링크 : https://jung-max.github.io/2019/10/22/Device_Tree_문법/]

 

도대체 저 매크로는 어떻게 dtb에서 인식을 하고 쓰는거지? 하고 찾아보니

아래의 경로에서 dt-bindings 라는 곳에서 정의가 되어있었다.

linux-master/scripts/dtc/include-prefixes/dt-bindings/usb

 

선언을 하도 여러군데서 하다보니 일반소스에서만 선언된 줄 알았는데..

#define PDO_FIXED(mv, ma, flags) \
    (PDO_TYPE(PDO_TYPE_FIXED) | (flags) | \
    PDO_FIXED_VOLT(mv) | PDO_FIXED_CURR(ma))

 

device tress binding 이라는 녀석이 또 추가 되었나 보다..

[링크 : https://docs.zephyrproject.org/latest/build/dts/bindings.html]

'Linux API > linux' 카테고리의 다른 글

linux 시리얼 포트 열기(termios)  (0) 2025.10.11
LD_DEBUG=libs  (0) 2025.06.02
usb hid, hidraw  (0) 2024.03.11
linux 멀티터치 프로토콜  (0) 2024.03.08
btrfs CoW  (0) 2024.02.15
Posted by 구차니