GithubHelp home page GithubHelp logo

Comments (5)

kylelemons avatar kylelemons commented on June 18, 2024

What's the use case behind this? Typically you have very specific devices
to talk to and they often need to be managed independently even if they are
performing the same tasks.

On Mon, Aug 29, 2016, 5:33 PM Ewan Valentine [email protected]
wrote:

Hi there,

I have the following range loop, I'm attempting to write a file output to
each device. Is this possible?

for _, dev := range devs {
// Once the device has been selected from ListDevices, it is opened
// and can be interacted with.

    conf, err := dev.ActiveConfig()
    if err != nil {
        log.Fatalf("Cannot get active config: %s", err)
    }

    write, err := dev.OpenEndpoint(conf, uint8(0),
        uint8(0), uint8(2)|uint8(usb.ENDPOINT_DIR_OUT))
    if err != nil {
        log.Fatalf("Failed to open write endpoint: %s", err)
    }

    write.Write([]byte("test"))

}


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#20, or mute the thread
https://github.com/notifications/unsubscribe-auth/AATqpf5KB_LR8rSkIIRLgBKW-HHz_y0zks5qk3pKgaJpZM4JwCKB
.

from gousb.

EwanValentine avatar EwanValentine commented on June 18, 2024

I'm attempting to listen for new USB storage devices being attached, and transferring a file to them once detected. Is there a way of return the device path, perhaps, with this library? I couldn't see anything like that from the docs. I think I might have to try something different. I get what you mean about devices needing to be managed independently.

from gousb.

kylelemons avatar kylelemons commented on June 18, 2024

Are you planning on speaking the USB Mass Storage protocol to the device
raw and do the filesystem emulation yourself? I would imagine that it
would be far more robust to let the OS manage and auto-mount devices and
then write the file to the filesystem.

On Wed, Aug 31, 2016, 3:16 AM Ewan Valentine [email protected]
wrote:

I'm attempting to listen for new USB storage devices being attached, and
transferring a file to them once detected. Is there a way of return the
device path, perhaps, with this library? I couldn't see anything like that
from the docs. I think I might have to try something different. I get what
you mean about devices needing to be managed independently.


You are receiving this because you commented.

Reply to this email directly, view it on GitHub
#20 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AATqpXyYnBp5qU1ovbu-zd34WepXCtrgks5qlVSGgaJpZM4JwCKB
.

from gousb.

EwanValentine avatar EwanValentine commented on June 18, 2024

Yeah that's probably the best solution, I mean to let the OS handle all of that. But in order to handle it through the OS, I need to know the location of the new storage device. So I can use this library to figure out if there's a new device plugged in, but I don't know how to get the filepath for that device then. If that makes sense?

from gousb.

kylelemons avatar kylelemons commented on June 18, 2024

As far as I know there's no way to get that from the device itself, you
need the kernel for that. I'd suggest watching the directories your OS
uses for auto mounting, watching dmesg, maybe there are some /sys or /proc
files that could help. You might also be able to plug into udev or similar.

On Wed, Aug 31, 2016, 6:12 AM Ewan Valentine [email protected]
wrote:

Yeah that's probably the best solution, I mean to let the OS handle all of
that. But in order to handle it through the OS, I need to know the location
of the new storage device. So I can use this library to figure out if
there's a new device plugged in, but I don't know how to get the filepath
for that device then. If that makes sense?


You are receiving this because you commented.

Reply to this email directly, view it on GitHub
#20 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AATqpQ-5eCrpHc22A_Rh1d419SaTGDfdks5qlX3VgaJpZM4JwCKB
.

from gousb.

Related Issues (18)

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.