douyou8047 2014-07-11 19:24
浏览 572

在Go中使用USB

Can somebody provide an example of using go-libusb (or may be any other lib working with USB in Golang) .

  1. I have created package libusb
  2. Copied the content from https://github.com/popons/go-libusb/blob/main/libusb.go

There is an error:

Unresolved symbol: '_Cstruct_usb_device_descriptor' 

Thank you.

  • 写回答

2条回答 默认 最新

  • dongmi3203 2014-07-11 19:55
    关注

    First you have to install libusb from http://www.libusb.org/wiki/libusb-win32, then either change // #include<usb.h> to:

    /*
        #cgo LDFLAGS: -lusb
        #include <usb.h>
    */
    

    And descriptor _Cstruct_usb_device_descriptor to descriptor C.struct_usb_device_descriptor.

    Or pull my fork from https://github.com/OneOfOne/go-libusb, I already sent a pull request with the changes.

    评论

报告相同问题?

悬赏问题

  • ¥15 MCNP里如何定义多个源?
  • ¥20 双层网络上信息-疾病传播
  • ¥50 paddlepaddle pinn
  • ¥20 idea运行测试代码报错问题
  • ¥15 网络监控:网络故障告警通知
  • ¥15 django项目运行报编码错误
  • ¥15 请问这个是什么意思?
  • ¥15 STM32驱动继电器
  • ¥15 Windows server update services
  • ¥15 关于#c语言#的问题:我现在在做一个墨水屏设计,2.9英寸的小屏怎么换4.2英寸大屏