Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mac枚举串口列表失败,getSerialPath有Bug #75

Closed
xxCabin opened this issue May 24, 2023 · 1 comment
Closed

Mac枚举串口列表失败,getSerialPath有Bug #75

xxCabin opened this issue May 24, 2023 · 1 comment
Labels

Comments

@xxCabin
Copy link

xxCabin commented May 24, 2023

/描述bug
Mac枚举串口失败
`char *getSerialPath(char *dest, io_object_t &serialPort)
{
CFTypeRef calloutCFString;

calloutCFString = IORegistryEntryCreateCFProperty(serialPort, CFSTR(kIOCalloutDeviceKey), kCFAllocatorDefault, 0);

if (calloutCFString)
{
    // sizeof(dest) = 8bytes, can not copy all bytes
    // CFStringGetCString(static_cast<CFStringRef>(calloutCFString), dest, sizeof(dest), kCFStringEncodingUTF8);

    CFStringGetCString(static_cast<CFStringRef>(calloutCFString), dest, MAXPATHLEN, kCFStringEncodingUTF8);

    CFRelease(calloutCFString);
}

return dest;

}`

重现步骤
mac下,调用getPortInfoList
预期行为

截图
image

运行环境信息:

  • 操作系统: mac12.6.3
  • 编译器:xcode 14.0
  • 版本号:v4.3.0

其他内容

@itas109
Copy link
Owner

itas109 commented May 26, 2023

感谢反馈,可以加群交流

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants