mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-11-09 14:40:10 +01:00
PhycialDisplay (macOS): add support
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
#pragma once
|
||||
|
||||
#ifndef FASTFETCH_INCLUDED_util_apple_ddcci_h
|
||||
|
||||
#include <CoreGraphics/CoreGraphics.h>
|
||||
|
||||
// DDC/CI
|
||||
typedef CFTypeRef IOAVServiceRef;
|
||||
extern IOAVServiceRef IOAVServiceCreate(CFAllocatorRef allocator) __attribute__((weak_import));
|
||||
extern IOAVServiceRef IOAVServiceCreateWithService(CFAllocatorRef allocator, io_service_t service) __attribute__((weak_import));
|
||||
extern IOReturn IOAVServiceCopyEDID(IOAVServiceRef service, CFDataRef* x2) __attribute__((weak_import));
|
||||
extern IOReturn IOAVServiceReadI2C(IOAVServiceRef service, uint32_t chipAddress, uint32_t offset, void* outputBuffer, uint32_t outputBufferSize) __attribute__((weak_import));
|
||||
extern IOReturn IOAVServiceWriteI2C(IOAVServiceRef service, uint32_t chipAddress, uint32_t dataAddress, void* inputBuffer, uint32_t inputBufferSize) __attribute__((weak_import));
|
||||
|
||||
#endif
|
||||
@@ -1,13 +1,13 @@
|
||||
#include "edidHelper.h"
|
||||
|
||||
void ffEdidGetPhycialDisplay(uint8_t edid[128], uint32_t* width, uint32_t* height)
|
||||
void ffEdidGetPhycialDisplay(const uint8_t edid[128], uint32_t* width, uint32_t* height)
|
||||
{
|
||||
const int dtd = 54;
|
||||
*width = (((uint32_t) edid[dtd + 4] >> 4) << 8) | edid[dtd + 2];
|
||||
*height = (((uint32_t) edid[dtd + 7] >> 4) << 8) | edid[dtd + 5];
|
||||
}
|
||||
|
||||
void ffEdidGetName(uint8_t edid[128], FFstrbuf* name)
|
||||
void ffEdidGetName(const uint8_t edid[128], FFstrbuf* name)
|
||||
{
|
||||
// https://github.com/jinksong/read_edid/blob/master/parse-edid/parse-edid.c
|
||||
for (uint32_t i = 0x36; i < 0x7E; i += 0x12)
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include <stdint.h>
|
||||
#include "util/FFstrbuf.h"
|
||||
|
||||
void ffEdidGetPhycialDisplay(uint8_t edid[128], uint32_t* width, uint32_t* height);
|
||||
void ffEdidGetName(uint8_t edid[128], FFstrbuf* name);
|
||||
void ffEdidGetPhycialDisplay(const uint8_t edid[128], uint32_t* width, uint32_t* height);
|
||||
void ffEdidGetName(const uint8_t edid[128], FFstrbuf* name);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user