Skip to content

feat: add device hotplug event notifications (USB on Linux)#158

Merged
mengzhuo merged 1 commit intosipeed:mainfrom
easyzoom:feat/device-hotplug-notifications
Feb 14, 2026
Merged

feat: add device hotplug event notifications (USB on Linux)#158
mengzhuo merged 1 commit intosipeed:mainfrom
easyzoom:feat/device-hotplug-notifications

Conversation

@easyzoom
Copy link
Contributor

feat: add device hotplug event notifications

  • Add pkg/devices package for extensible device event monitoring
  • Support USB hotplug via udevadm (Linux only, stub on other platforms)
  • Send notifications to last active channel when USB device plugged/unplugged
  • Config: devices.enabled, devices.monitor_usb
  • Use UDEV events only to avoid duplicate/incomplete notifications

feat: 设备热插拔事件通知

  • 新增 pkg/devices 包,支持设备事件监听
  • Linux 下通过 udevadm 监听 USB 插拔
  • 将通知发送到最近活跃的渠道
  • 配置项:devices.enabled, devices.monitor_usb
  • 仅处理 UDEV 事件,避免重复/信息不完整

ev.Vendor = props["ID_VENDOR_ID"]
}
if ev.Vendor == "" {
ev.Vendor = "未知厂商"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change that into English

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The content has been updated.

ev.Product = props["ID_MODEL_ID"]
}
if ev.Product == "" {
ev.Product = "未知设备"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change that into English

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The content has been updated.

ev.Capabilities = usbClassToCapability[strings.ToLower(class)]
}
if ev.Capabilities == "" {
ev.Capabilities = "USB 设备"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change that into English

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The content has been updated.

@mengzhuo
Copy link
Collaborator

It seems you needs make fmt first.

@easyzoom easyzoom force-pushed the feat/device-hotplug-notifications branch from 4f14a50 to 3780455 Compare February 14, 2026 09:06
@easyzoom
Copy link
Contributor Author

看来你需要make fmt优先考虑。
I have run make fmt and pushed the formatted changes.

@mengzhuo mengzhuo merged commit b805ec8 into sipeed:main Feb 14, 2026
3 checks passed
emadomedher pushed a commit to emadomedher/picoclaw that referenced this pull request Feb 17, 2026
…ications

feat: add device hotplug event notifications (USB on Linux)
StarWindv referenced this pull request in StarWindv/PicoClaw-shou Feb 19, 2026
feat: add device hotplug event notifications (USB on Linux)
@Orgmar
Copy link
Contributor

Orgmar commented Feb 19, 2026

@easyzoom USB热插拔通知这个功能很实用,用udevadm监听UDEV事件来避免重复通知的思路也很清晰,整体设计挺不错的。

对了,我们正在组建 PicoClaw Dev Group,方便贡献者们在Discord上更紧密地交流协作。如果感兴趣的话,发一封邮件到 [email protected],主题写 [Join PicoClaw Dev Group] + 你的GitHub账号,我们会把Discord邀请链接发给你!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants