Code Monkey home page Code Monkey logo

libusbp's People

Contributors

davidegrayson avatar jaytolttech avatar jporcher avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

libusbp's Issues

Does not build with MSYS2 mingw64 on Windows 11

I followed the instructions to the letter with a brand new install of MSYS2.

However, at the point of running the CMAKE command, all I get is this:

MINGW64 ~/libusbp/build
$ MSYS2_ARG_CONV_EXCL=- cmake .. -G"MSYS Makefiles" -DCMAKE_INSTALL_PREFIX=$MINGW_PREFIX
CMake Error: CMake was unable to find a build program corresponding to "MSYS Makefiles".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_AR was not found, please set to archive program.
-- Configuring incomplete, errors occurred!

I'm guessing that either some assumptions are made about things that have already been installed, or I'm mis-interpreting something.

I ran this as advised in a similar issue:

$ echo $MSYSTEM
which cmake
which gcc
MINGW64
/mingw64/bin/cmake
/mingw64/bin/gcc

Please advise.

(I had no problems with the macOS or Linux builds, btw)

Thoughts on compatibility with libusb?

I was wondering what your thoughts were on some day offering an interface that is compatible with libusb, so that for some applications libusbp could be offered as a drop-in-replacement.

I am personally working with libftdi.

What was your experience with contributing changes to libusb that you made your own library?

FTDI port number cannot be retrieved on Windows

I'm plugging an FTDI based device, under Windows 10. When I plug it and use windows API SetupDiGetClassDevs/SetupDiEnumDeviceInfo/SetupDiGetDeviceRegistryProperty, I find device named FTDIBUS\COMPORT&VID_0403&PID_6001 with port name "COM8".

Now, when I use libusbp/lsport, the device is found (0403:6001 AR0JFBPE) but its port name cannot be identified, all call to try_print_port_name returns false. I even changed the loop parameter to test the 256 possible interface_number with no success.

port_name : Error

  • port_name example throws error 'The PortName key was not found' for a USB printer Vendor Id: 0x0A5F, Product Id: 0x0081, interface_number = 0, composite = false.
  • But the other examples like 'lsport' and 'lsusb' where successfully detect the device.

undefined reference to `libusbp_error_free'

I installed the library as explained in the readme file and had no issues. Used it without problems. Recenntly I tried to build my ROS project (ROS kinetic/Ubuntu 16.04) which includes the libusbp library and I'm getting a compilation error.

CMakeFiles/gimbal_interface_node.dir/src/gimbal_interface_node.cpp.o: In function libusbp::pointer_free(libusbp_error*)': gimbal_interface_node.cpp:(.text._ZN7libusbp12pointer_freeEP13libusbp_error[_ZN7libusbp12pointer_freeEP13libusbp_error]+0x14): undefined reference to libusbp_error_free'

CMakeFiles/gimbal_interface_node.dir/src/gimbal_interface_node.cpp.o: In function libusbp::pointer_free(libusbp_device*)': gimbal_interface_node.cpp:(.text._ZN7libusbp12pointer_freeEP14libusbp_device[_ZN7libusbp12pointer_freeEP14libusbp_device]+0x14): undefined reference to libusbp_device_free'

Then there are a couple more undefined reference to other functions.

Need to access device's friendly name

Under Windows, I need to access device's friendly name (SetupDiGetDeviceRegistryProperty with property SPDRP_FRIENDLYNAME).

This information is not part of libusbp::device. May it be added to the API? It's probably only available under Windows, I did not check. Would that be an acceptable pull request?

Else, can one retrieve the internal device handle from libusbp::device and later call SetupDiGetDeviceRegistryProperty?

cmake not working on win10 under msys2

The command
MSYS2_ARG_CONV_EXCL=- cmake .. -G"MSYS Makefiles" -DCMAKE_INSTALL_PREFIX=$MINGW_PREFIX
issues an error saying MSYS generator is not available.

I built it using
MSYS2_ARG_CONV_EXCL=- cmake .. -G"Unix Makefiles" -DCMAKE_INSTALL_PREFIX=$MINGW_PREFIX
but there was no definition of WINDOWS, APPLE nor LINUX for CMakeLists.txt. As a workaround I edited it to include only the windows relative files.

make install DESTDIR=/
failed to write the output libraries on windows, I think it needs the destdir to be absolute rather than relative.

Jake

Jake

macOS Port is not found for FTDI devices

Hi,

On macOS, because of the interface_number += 1, the port is not found for FTDI devices. Here is how it's reported with ioreg:

+-o FT232R USB UART@14400000  <class IOUSBHostDevice, id 0x100017a14, registered, matched, active, busy 0 (78 ms), retain 25>
  | {
  |   "kUSBSerialNumberString" = "AE01EB7D"
  |   "bDeviceClass" = 0
  |   "bDeviceSubClass" = 0
  |   "iSerialNumber" = 3
  |   "Built-In" = No
  |   "IOServiceDEXTEntitlements" = (("com.apple.developer.driverkit.transport.usb"))
  |   "iProduct" = 2
  |   "USB Serial Number" = "AE01EB7D"
  |   "USB Vendor Name" = "FTDI"
  |   "USBSpeed" = 1
  |   "IOPowerManagement" = {"PowerOverrideOn"=Yes,"CapabilityFlags"=32768,"MaxPowerState"=2,"DevicePowerState"=2,"DriverPowerState"=0,"ChildrenPowerState"=2,"CurrentPowerState"=2}
  |   "bNumConfigurations" = 1
  |   "kUSBProductString" = "FT232R USB UART"
  |   "IOServiceLegacyMatchingRegistryID" = 4295064086
  |   "kUSBVendorString" = "FTDI"
  |   "USB Product Name" = "FT232R USB UART"
  |   "iManufacturer" = 1
  |   "idVendor" = 1027
  |   "Device Speed" = 1
  |   "kUSBCurrentConfiguration" = 1
  |   "idProduct" = 24577
  |   "bcdDevice" = 1536
  |   "sessionID" = 19421559036399
  |   "USB Address" = 6
  |   "non-removable" = "no"
  |   "IOCFPlugInTypes" = {"9dc7b780-9ec0-11d4-a54f-000a27052861"="IOUSBHostFamily.kext/Contents/PlugIns/IOUSBLib.bundle"}
  |   "IOClassNameOverride" = "IOUSBDevice"
  |   "USBPortType" = 0
  |   "bDeviceProtocol" = 0
  |   "locationID" = 339738624
  |   "kUSBAddress" = 6
  |   "bcdUSB" = 512
  |   "IOGeneralInterest" = "IOCommand is not serializable"
  |   "bMaxPacketSize0" = 8
  | }
  | 
  +-o AppleUSBHostLegacyClient  <class AppleUSBHostLegacyClient, id 0x100017a17, !registered, !matched, active, busy 0, retain 8>
  |   {
  |     "IOPowerManagement" = {"DevicePowerState"=0,"CurrentPowerState"=1,"CapabilityFlags"=65536,"MaxPowerState"=2,"DriverPowerState"=1}
  |   }
  |   
  +-o AppleUSBHostCompositeDevice  <class AppleUSBHostCompositeDevice, id 0x100017a1b, !registered, !matched, active, busy 0, retain 4>
  |   {
  |     "IOClass" = "AppleUSBHostCompositeDevice"
  |     "CFBundleIdentifier" = "com.apple.driver.usb.AppleUSBHostCompositeDevice"
  |     "IOProviderClass" = "IOUSBHostDevice"
  |     "kUSBPreferredConfiguration" = 1
  |     "IOProbeScore" = 50000
  |     "IOMatchedAtBoot" = Yes
  |     "IOMatchCategory" = "IODefaultMatchCategory"
  |     "bDeviceSubClass" = 0
  |     "IOPersonalityPublisher" = "com.apple.driver.usb.AppleUSBHostCompositeDevice"
  |     "CFBundleIdentifierKernel" = "com.apple.driver.usb.AppleUSBHostCompositeDevice"
  |     "IOPrimaryDriverTerminateOptions" = Yes
  |     "bDeviceClass" = 0
  |   }
  |   
  +-o FT232R USB UART@0  <class IOUSBHostInterface, id 0x100017a1d, registered, matched, active, busy 0 (13 ms), retain 8>
    | {
    |   "USBSpeed" = 1
    |   "iInterface" = 2
    |   "IOServiceLegacyMatchingRegistryID" = 4295064094
    |   "bInterfaceProtocol" = 255
    |   "bAlternateSetting" = 0
    |   "idProduct" = 24577
    |   "bcdDevice" = 1536
    |   "USB Interface Name" = "FT232R USB UART"
    |   "USB Product Name" = "FT232R USB UART"
    |   "locationID" = 339738624
    |   "bInterfaceClass" = 255
    |   "bInterfaceSubClass" = 255
    |   "IOCFPlugInTypes" = {"2d9786c6-9ef3-11d4-ad51-000a27052861"="IOUSBHostFamily.kext/Contents/PlugIns/IOUSBLib.bundle"}
    |   "USBPortType" = 0
    |   "kUSBString" = "FT232R USB UART"
    |   "bInterfaceNumber" = 0
    |   "bConfigurationValue" = 1
    |   "USB Vendor Name" = "FTDI"
    |   "idVendor" = 1027
    |   "IOServiceDEXTEntitlements" = (("com.apple.developer.driverkit.transport.usb"))
    |   "bNumEndpoints" = 2
    |   "IODEXTMatchCount" = 1
    |   "USB Serial Number" = "AE01EB7D"
    |   "IOGeneralInterest" = "IOCommand is not serializable"
    |   "IOClassNameOverride" = "IOUSBInterface"
    | }
    | 
    +-o AppleUSBFTDI  <class IOUserSerial, id 0x100017a1f, registered, matched, active, busy 0 (0 ms), retain 11>
      | {
      |   "IOClass" = "IOUserSerial"
      |   "CFBundleIdentifier" = "com.apple.DriverKit-AppleUSBFTDI"
      |   "IOProviderClass" = "IOUSBHostInterface"
      |   "IOUserServerCDHash" = "e213b87cfe13c360790f296eb70a1d2f2868de1b"
      |   "IOServiceDEXTEntitlements" = "com.apple.developer.driverkit.family.serial"
      |   "IOTTYBaseName" = "usbserial-"
      |   "idProduct" = 24577
      |   "IOProbeScore" = 89999
      |   "bConfigurationValue" = 1
      |   "IOMatchedPersonality" = {"bInterfaceNumber"=0,"IOUserClass"="AppleUSBFTDI","IOProviderClass"="IOUSBHostInterface","IOClass"="IOUserSerial","IOUserServerCDHash"="e213b87cfe13c360790f296eb70a1d2f2868de1b","CFBundleIdentifierKernel"="com.apple.driver.driverkit.serial","idProduct"=24577,"CFBundleIdentifier"="com.apple.DriverKit-AppleUSBFTDI","bConfigurationValue"=1,"idVendor"=1027,"IOUserServerName"="com.apple.DriverKit.AppleUSBFTDI"}
      |   "IOUserServerName" = "com.apple.DriverKit.AppleUSBFTDI"
      |   "HiddenPort" = Yes
      |   "IOMatchCategory" = "IODefaultMatchCategory"
      |   "IOPowerManagement" = {"CapabilityFlags"=2,"MaxPowerState"=2,"CurrentPowerState"=2}
      |   "idVendor" = 1027
      |   "CFBundleIdentifierKernel" = "com.apple.driver.driverkit.serial"
      |   "IOTTYSuffix" = "AE01EB7D"
      |   "bInterfaceNumber" = 0
      |   "IOUserClass" = "AppleUSBFTDI"
      | }
      | 
      +-o IOSerialBSDClient  <class IOSerialBSDClient, id 0x100017a22, registered, matched, active, busy 0 (0 ms), retain 5>
          {
            "IOClass" = "IOSerialBSDClient"
            "CFBundleIdentifier" = "com.apple.iokit.IOSerialFamily"
            "IOProviderClass" = "IOSerialStreamSync"
            "IOTTYBaseName" = "usbserial-"
            "IOSerialBSDClientType" = "IOSerialStream"
            "IOProbeScore" = 1000
            "IOResourceMatch" = "IOBSD"
            "IOMatchedAtBoot" = Yes
            "IOMatchCategory" = "IODefaultMatchCategory"
            "IOTTYDevice" = "usbserial-AE01EB7D"
            "IOCalloutDevice" = "/dev/cu.usbserial-AE01EB7D"
            "IODialinDevice" = "/dev/tty.usbserial-AE01EB7D"
            "IOPersonalityPublisher" = "com.apple.iokit.IOSerialFamily"
            "CFBundleIdentifierKernel" = "com.apple.iokit.IOSerialFamily"
            "IOTTYSuffix" = "AE01EB7D"
          }

Project can't be included as a sub-project of another CMake project

Attempting to use CMakes fetchcontent() facility or simply including this project as a sub-project (or dependency) of another CMake project fails due to incorrect use of CMAKE_SOURCE_DIR in when setting up the include paths in src/CMakeLists.txt

The use of CMAKE_SOURCE_DIR should be replaced with CMAKE_PROJECT_SOURCE_DIR.
Additionally the use of CMAKE_CURRENT_*_DIR variables should probably be changed to use the CMAKE_PROJECT_*_DIR versions.

There maybe other similar changes required.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.