黑苹果hidp显示不清楚_macOS 2K 显示屏开启 HiDPI 解决字体小或模糊

charm

一、原理

强烈推荐阅读 有关retina和HiDPI那点事 ,文中解释相当清晰。而我们开启 HiDPI 的作用:牺牲整个屏幕可显示的信息量,换取更加细腻的显示效果。

例如:我的屏幕默认分辨率为 2560x1440,开启 HiDPI 后,仅显示 1920x1080 信息量,相当于之前 1 个像素内容用 1.3 个像素来表达。这正好满足我们需求,字更大,也更清晰。

由于 macOS 4k 以上才默认开启 HiDPI,我们 2k 屏就要自己动手开启。

开启思路是修改 /System/Library/Displays/Contents/Resources/Overrides/DisplayVendorID-xxxx/DisplayProductID-xxxx 配置文件,写入需要 macOS 针对该型号屏幕输出像素数,例如:屏幕 HiDPI 1920x1080 需 macOS 系统输出 2 倍像素数即 3840x2160。

再通过工具切换为 HiDPI 模式即可。例如:Resolution Menu, RDM , QuickRes 等。(下载地址见文末)

二、步骤

个人显示器为 DELL P2418D,得到该放至 /System/Library/Displays/Contents/Resources/Overrides/DisplayVendorID-10ac/DisplayProductID-d0c2 文件。

sudo cp ~/Downloads/DisplayProductID-d0c2.plist /System/Library/Displays/Contents/Resources/Overrides/DisplayVendorI

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
鼠标HID描述符中的坐标描述符通常被称为Input项,可以使用解析HID报告的方式来获取当前坐标的描述符。 在Windows操作系统中,可以使用HID库(HID.DLL)提供的API来解析HID报告和获取Input项的信息。以下是一个示例代码(使用Python): ```python import ctypes import struct # 定义HIDP_CAPS结构体 class HIDP_CAPS(ctypes.Structure): _fields_ = [ ('Usage', ctypes.c_ushort), ('UsagePage', ctypes.c_ushort), ('InputReportByteLength', ctypes.c_ushort), ('OutputReportByteLength', ctypes.c_ushort), ('FeatureReportByteLength', ctypes.c_ushort), ('Reserved', ctypes.c_ushort * 17), ('NumberLinkCollectionNodes', ctypes.c_ushort), ('NumberInputButtonCaps', ctypes.c_ushort), ('NumberInputValueCaps', ctypes.c_ushort), ('NumberInputDataIndices', ctypes.c_ushort), ('NumberOutputButtonCaps', ctypes.c_ushort), ('NumberOutputValueCaps', ctypes.c_ushort), ('NumberOutputDataIndices', ctypes.c_ushort), ('NumberFeatureButtonCaps', ctypes.c_ushort), ('NumberFeatureValueCaps', ctypes.c_ushort), ('NumberFeatureDataIndices', ctypes.c_ushort) ] # 获取HID设备的句柄 hid_handle = ctypes.windll.hid.HidD_Open(vid, pid, None) if hid_handle == 0: print('Failed to open HID device.') exit() # 获取HIDP_CAPS结构体 hidp_caps = HIDP_CAPS() hidp_caps_size = ctypes.c_ulong(ctypes.sizeof(hidp_caps)) ctypes.windll.hid.HidP_GetCaps(hid_handle, ctypes.byref(hidp_caps)) # 获取Input项的信息 input_report_desc = ctypes.create_string_buffer(hidp_caps.InputReportByteLength) ctypes.windll.hid.HidP_GetExtendedAttributes( ctypes.c_ulong(HidP_ReportType_Input), ctypes.c_ushort(0), ctypes.byref(input_report_desc), ctypes.byref(hidp_caps_size), hid_handle ) # 解析Input项的信息 items = [] for byte in input_report_desc: for bit in reversed(range(8)): items.append(byte >> bit & 1) # 获取当前坐标的描述符 x_index = -1 y_index = -1 for i, item in enumerate(items): if item == 2: # HID_USAGE_PAGE_GENERIC if items[i+1] == 1: # HID_USAGE_GENERIC_MOUSE if items[i+2] == 0x30: # HID_USAGE_PAGE_GENERIC_X x_index = struct.unpack('B', bytes([items[i+3]]))[0] elif items[i+2] == 0x31: # HID_USAGE_PAGE_GENERIC_Y y_index = struct.unpack('B', bytes([items[i+3]]))[0] print('X index:', x_index) print('Y index:', y_index) ``` 这个示例代码仅仅是演示了如何解析HID报告和获取Input项的信息,实际应用中还需要根据具体情况进行调整和优化。另外,不同的鼠标HID描述符可能有不同的格式和结构,需要根据具体情况进行解析。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值