Skip to content
This repository has been archived by the owner on Mar 7, 2023. It is now read-only.

Mount point of connected device (devicePath) #19

Open
skyksandr opened this issue Nov 2, 2015 · 7 comments
Open

Mount point of connected device (devicePath) #19

skyksandr opened this issue Nov 2, 2015 · 7 comments

Comments

@skyksandr
Copy link

Hi,

Is there any way to get mount point of connected device?

@MadLittleMods
Copy link
Owner

MadLittleMods commented Nov 3, 2015

@skyksandr
Copy link
Author

For OS X I think it can be possible with kiobsdnamekey.

CFStringRef bsdName = ( CFStringRef ) IORegistryEntrySearchCFProperty ( usbDevice,
                                                                       kIOServicePlane,
                                                                       CFSTR ( kIOBSDNameKey ),
                                                                       kCFAllocatorDefault,
                                                                       kIORegistryIterateRecursively );

Found here: http://stackoverflow.com/questions/2459414/osx-how-to-get-a-volume-name-or-bsd-name-from-a-iousbdeviceinterface-or-locat

But because I'm not familiar with C++ and IOKit I failed with make it work by just adding this code to detection_mac.cpp

@skyksandr
Copy link
Author

I made simple usb-mount-notifier if anyone interested to.
https://github.com/skyksandr/usb-mount-notifier/tree/master

going to use it this way:

var spawn = require('child_process').spawn,
    usb_notifier = spawn('usb-mount-notifier');

usb_notifier.stdout.on('data', function (data) {
  console.log('stdout: ' + data);
});

@sboudouk
Copy link

Can you make a simple README where you explain how to install it @skyksandr ? Does this work for Linux / Windows ?

@skyksandr
Copy link
Author

@sboudouk Nope, it doesn't. But I figured out how to handle this on windows. You can find 'copy-pastable' solution here:
https://github.com/skyderby/skyderby_desktop/blob/master/app/usb-mount-notify.js
Windows part a bit complicated but it is it simplest solution I think.

To install usb-mount-notifier just copy binary from build directory to your project.

It would be nice If someone helps with Linux part.

UPD: forget about dependencies - you'll need ref and ref-struct modules installed.

@sboudouk
Copy link

sboudouk commented Nov 23, 2015

Thanks for your answer @skyksandr , I starred you by the way.

@MadLittleMods MadLittleMods changed the title Mount point of connected device Mount point of connected device (devicePath) Nov 24, 2017
@sudhakar3697
Copy link

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants