KDK_EDID_GET_PRIMARY(3)

📦 version 3.0.1.4, in arch rolling, ubuntu resolute, ubuntu stonking

💖 KDK_EDID_GET_PRIMARY 💖

okay bestie, so this one lives in the Library Functions Manual section 3 (that's the "you're a C programmer now" section, iykyk), and it's about one (1) very specific little question: is this screen the main character or not? 🫶


✨ NAME ✨

kdk_edid_get_primary — 获取是否是主显示器(是/否)


🎀 SYNOPSIS 🎀

like, here's the whole vibe upfront:

#include <libkyedid.h>

extern int kdk_edid_get_primary(char *name);

Link with -lkyedid.

not me giving you the entire include + the link flag so you literally cannot mess it up 💅


🌸 DETAILED DESCRIPTION 🌸

so the whole entire point of this function is to figure out whether the screen in question is the main screen. that's it. that's the job. no cap.

the argument name is the current interface of the screen. that's the thing you hand it, and it goes and checks. 🌈


⭐ RETURN VALUE ⭐

  • on success, it returns 1, which means yes, this is the primary screen. slay. 👑
  • it returns 0 if it is not the primary screen. still valid, still loved, just not the main character. 🦋
  • on error, it returns -1. 😭

💜 EXAMPLES 💜

here's the full little demo, copied exactly, every line, no skipping:

#include "libkyedid.h"
#include <stdio.h>
#include <stdlib.h>

int main()
{
    char** name = kdk_edid_get_interface();
    size_t count = 0;
    while (name[count])
    {
        printf("当前接口 = %s0, name[count]);
        float gamma = kdk_edid_get_gamma(name[count]);
        printf("gamma = %0.2f0, gamma);
        float size = kdk_edid_get_size(name[count]);
        printf("size = %0.1f0, size);
        char *max_resolution = kdk_edid_get_max_resolution(name[count]);
        printf("max_resolution = %s0, max_resolution);
        free(max_resolution);
        char *model = kdk_edid_get_model(name[count]);
        printf("model = %s0, model);
        free(model);
        char *area = kdk_edid_get_visible_area(name[count]);
        printf("area = %s0, area);
        free(area);
        char *manufacturer = kdk_edid_get_manufacturer(name[count]);
        printf("manufacturer = %s0, manufacturer);
        free(manufacturer);
        int week = kdk_edid_get_week(name[count]);
        printf("week = %d0, week);
        int year = kdk_edid_get_year(name[count]);
        printf("year = %d0, year);
        int primary = kdk_edid_get_primary(name[count]);
        printf("%s0, primary == 1 ? "是" : "否");

        char *resolution = kdk_edid_get_resolution(name[count]);
        printf("resolution = %s0, resolution);
        free(resolution);

        char *ratio = kdk_edid_get_ratio(name[count]);
        printf("ratio = %s0, ratio);
        free(ratio);

        char *character = kdk_edid_get_character(name[count]);
        printf("character = %s0, character);
        free(character);

        printf("---------------------------------------0);
        count ++;
    }
    kdk_edid_freeall(name);
    return 0;
}

the way that loop just walks every interface and prints everything about it… obsessed. and yes, it frees everything and calls kdk_edid_freeall(name) at the end, because we are responsible queens 🧚


💅 CONFORMING TO 💅

these functions are as per the withdrawn POSIX.1e draft specification. (withdrawn! gone! historical! we still love her though. 💀)

the following functions are Linux extensions:

  • kdk_edid_get_interface()
  • kdk_edid_get_gamma()
  • kdk_edid_get_size()
  • kdk_edid_get_max_resolution()
  • kdk_edid_get_model()
  • kdk_edid_get_visible_area()
  • kdk_edid_get_manufacturer()
  • kdk_edid_get_week()
  • kdk_edid_get_year()
  • kdk_edid_get_resolution()
  • kdk_edid_get_ratio()
  • kdk_edid_get_character()
  • kdk_edid_freeall()

🦋 SEE ALSO 🦋

go read her sisters, fr fr:


and that's the whole page bestie!! this one came from the Linux Programmer's Manual, dated Fri Aug 25 2023 — so it's giving vintage but make it iconic. go check if your monitor is the primary one, you deserve to know. bye bye!! ✨💖🎀

📦 where this page comes from