Code Monkey home page Code Monkey logo

Comments (10)

aletheia7 avatar aletheia7 commented on July 17, 2024

Linux: Debian Testing/Buster
libusb package: libusb-1.0-0:i386 2:1.0.22-2
gousb: 5115a55

from gousb.

zagrodzki avatar zagrodzki commented on July 17, 2024

To clarify: does this break the build (i.e. go build aborts with an error), or is it just a matter of build displaying a warning message?

If it's the latter, then I'd rather not make any changes in gousb to accomodate the new options - we would do that when we make the next large revision of the API, at which point I can simply require libusb >= 1.0.22 and don't need to define conditions based on libusb version.

If it's the former, I've updated the branch "set_debug" (https://github.com/google/gousb/tree/set_debug), would you mind trying it out? Travis offers me "trusty" as the newest ubuntu environment, which has much older libusb, my personal systems also don't have 1.0.22 yet. I could install a new system just for this, but since you already have an environment where it fails...

from gousb.

aletheia7 avatar aletheia7 commented on July 17, 2024

It does not break the build. However, the extra warning output messes (the source disappears, filed issue: fatih/vim-go#1832) with the vim-go plugin and editing, and consequently, other go files.

I will try set_debug today. Thank you.

from gousb.

aletheia7 avatar aletheia7 commented on July 17, 2024

Almost there. Now getting:

go build -v
# <redacted>/vendor/github.com/google/gousb
cgo-gcc-prolog: In function ‘_cgo_843581783fcb_Cfunc_libusb_set_debug’:
cgo-gcc-prolog:518:2: warning: ‘libusb_set_debug’ is deprecated: Use libusb_set_option instead [-Wdeprecated-declarations]                           
In file included from vendor/github.com/google/gousb/libusb.go:28:0:
/usr/include/libusb-1.0/libusb.h:1300:18: note: declared here
 void LIBUSB_CALL libusb_set_debug(libusb_context *ctx, int level);
                  ^~~~~~~~~~~~~~~~

from gousb.

zagrodzki avatar zagrodzki commented on July 17, 2024

That doesn't sound right: the code in that branch doesn't call C.libusb_set_debug anymore (as indicated by Cfunc_libusb_set_debug in your snippet), it should now be calling C.gousb_set_debug (see libusb.go line 223). Can you make sure that the vendored code you're using was checked out from the set_debug branch?

from gousb.

aletheia7 avatar aletheia7 commented on July 17, 2024

The set_debug branch works great. Thank you.

from gousb.

aletheia7 avatar aletheia7 commented on July 17, 2024

I performed a git pull and my master is c6e7809.

The above problem has returned. The set_debug branch has disappeared, however I do have the has where your fix is. Any ideas what I have done wrong? Thank you.

$ go build -v
# <redacted ...>/vendor/github.com/google/gousb
cgo-gcc-prolog: In function ‘_cgo_843581783fcb_Cfunc_libusb_set_debug’:
cgo-gcc-prolog:518:2: warning: ‘libusb_set_debug’ is deprecated: Use libusb_set_option instead [-Wdeprecated-declarations]
In file included from ../vendor/github.com/google/gousb/libusb.go:28:0:
/usr/include/libusb-1.0/libusb.h:1300:18: note: declared here
 void LIBUSB_CALL libusb_set_debug(libusb_context *ctx, int level);
                  ^~~~~~~~~~~~~~~~
$ dpkg-query -W libusb\*
libusb-1.0-0:i386       2:1.0.22-2
libusb-1.0-0-dev:i386   2:1.0.22-2
libusb-1.0-doc  2:1.0.22-2
$ git status
On branch set_debug
Your branch is up to date with 'origin/set_debug'.

nothing to commit, working tree clean
$ git log | head -20
commit 9b217d35e1709b0e73fb7f48c3010dc748e3b030 (HEAD -> set_debug, origin/set_debug)
Author: Sebastian Zagrodzki <[email protected]>
Date:   Sat May 19 18:57:23 2018 +0200

    Support libusb_set_option in additon to libusb_set_debug.
    The latter is deprecated in libusb 1.0.22 and later.

commit d0366361a25268248b2e53405b91eaa0deadf761
Author: Sebastian Zagrodzki <[email protected]>
Date:   Sun Nov 12 03:32:09 2017 +0100

    Add missing arguments to Interface() error on failed descriptor
    retrieval.

commit b893afb0188fc0c9f9c3ae60bee6beb1b87af1b2
Author: Sebastian Zagrodzki <[email protected]>
Date:   Sun Nov 12 03:28:47 2017 +0100

    Add missing endpoint argument to Fatalf.

from gousb.

zagrodzki avatar zagrodzki commented on July 17, 2024

I'm guessing that the version in ../vendor/..../gousb is different from the one you pulled. Your message says: "In function ‘_cgo_843581783fcb_Cfunc_libusb_set_debug". Current master doesn't have Cfunc_libusb_set_debug anymore, it would be Cfunc_gousb_set_debug. This means that contrary to what you think, you're using an older revision of the code.

from gousb.

aletheia7 avatar aletheia7 commented on July 17, 2024

The only gousb I have is in my vendor directory.

The current master does have libusb_set_debug.

$ grep -nHr set_debug *
libusb.go:34:void gousb_set_debug(libusb_context *ctx, int lvl);
libusb.go:223:  C.gousb_set_debug((*C.libusb_context)(c), C.int(lvl))
libusb.go:503:  C.libusb_set_debug((*C.libusb_context)(c), C.int(lvl))
usb.c:18:void gousb_set_debug(libusb_context *ctx, int lvl) {
usb.c:24:    libusb_set_debug(ctx, lvl);

I was able to suppress the warning with the following code change:

func libusbSetDebug(c *libusbContext, lvl int) {                                                                                                                                                                     
    //#pragma GCC diagnostic push                                                                                                                                                                                    
    //#pragma GCC diagnostic ignored "-Wdeprecated-declaration"                                                                                                                                                      
    C.libusb_set_debug((*C.libusb_context)(c), C.int(lvl))                                                                                                                                                           
    //#pragma GCC diagnostic pop                                                                                                                                                                                     
}

I would prefer to use gousb master instead of my own branch.

from gousb.

zagrodzki avatar zagrodzki commented on July 17, 2024

I see, you're right. There are two places where libusb_set_debug used to be called, and I've updated only one of them. The other one is used only in tests, but it's part of the library, because using C in tests doesn't work well for some reason or other (as I recall). Updated the other one. Please check now. Sorry for confusion.

from gousb.

Related Issues (20)

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.