Author Topic: MTP plugin for Netdrive?  (Read 23948 times)

Paul Smedley

  • Hero Member
  • *****
  • Posts: 2092
  • Karma: +159/-0
    • View Profile
MTP plugin for Netdrive?
« on: June 26, 2016, 11:57:27 am »
Hi All,

Wondering how many people would find a MTP plugin for Netdrive useful?

For those that aren't aware, MTP is a very common protocol used for connecting multimedia devices (including devices like android phones).

No promises that this will happen, but I've been having some fun working on ndpsmb for use with samba 4.4.x - so I thought it might be useful to try creating a new plugin.

Some of this will also depend on how well virtualbox supports testing a usb device, as testing on real hardware isn't so easy here anymore....

Cheers,

Paul

Dariusz Piatkowski

  • Hero Member
  • *****
  • Posts: 1317
  • Karma: +26/-0
    • View Profile
Re: MTP plugin for Netdrive?
« Reply #1 on: June 26, 2016, 03:11:55 pm »
YES, absolutely interested, for the very reason you mentioned: mobile devices!

David McKenna

  • Hero Member
  • *****
  • Posts: 742
  • Karma: +24/-0
    • View Profile
Re: MTP plugin for Netdrive?
« Reply #2 on: June 26, 2016, 03:16:14 pm »
 I would definitely find it useful and could help test on real hardware if needed.

Doug Bissett

  • Hero Member
  • *****
  • Posts: 1593
  • Karma: +4/-2
    • View Profile
Re: MTP plugin for Netdrive?
« Reply #3 on: June 26, 2016, 06:45:34 pm »
Quote
Wondering how many people would find a MTP plugin for Netdrive useful?

Wondering why you don't just use Mediatomb (http://os2ports.smedley.id.au/index.php?page=mediatomb), which seems to work with my android phone, as well as with all of my other devices that have a browser and a network connection to the "server" (over WiFi, which is easier to use than USB, and it doesn't require additional software). The Mediatomb that is available is version 0.12.0, but I see that 0.12.1 is available for other platforms.

I don't have netdrive (other than what the SAMBA client for eCS supplies), and I haven't seen any compelling reason to acquire it.

I am not trying to discourage you, but I suspect that you could spend your time doing more useful things (WiFi comes to mind).

Dave Yeo

  • Hero Member
  • *****
  • Posts: 4786
  • Karma: +99/-1
    • View Profile
Re: MTP plugin for Netdrive?
« Reply #4 on: June 26, 2016, 07:29:19 pm »
I just tried mediatomb, dies with,
Quote
2016-06-26 10:22:12    INFO: Configuration check succeeded.
2016-06-26 10:22:12   ERROR: main: upnp error -208
2016-06-26 10:22:12   ERROR: Socket error.
2016-06-26 10:22:12    INFO: Please check if your network interface was configured for multicast!
2016-06-26 10:22:12    INFO: Refer to the README file for more information.
2016-06-26 10:22:12   ERROR: upnp_cleanup: UpnpUnRegisterRootDevice failed

F:\mediatomb\bin>ifconfig lan0
lan0: flags=bc63<UP,BROADCAST,NOTRAILERS,RUNNING,DEFMTU,MULTICAST,BRIDGE,SNAP,LOOPBRD>
        inet 192.168.0.2  netmask 0xffffff00 broadcast 192.168.0.255

MTP support would allow connecting devices much like a MSD. Currently here I can unmount the microsd card, risk losing it, plug it into an adapter and then into my OS/2 computers USB port and transfer files that way, or use FTP. FTP is slow over the wireless and the moving microsd card is a bit of a hassle

Doug Bissett

  • Hero Member
  • *****
  • Posts: 1593
  • Karma: +4/-2
    • View Profile
Re: MTP plugin for Netdrive?
« Reply #5 on: June 26, 2016, 09:09:10 pm »
Quote
I just tried mediatomb, dies with,

It was a few years ago (2011?) when I set it up, so I don't remember what I did. It still works perfectly, for me. The basic setup was to assign a user ID and password, then attach the file structure. FWIW, your ifconfig shows exactly the same as what I have (except for the address), so it is probably a program setup problem.

Quote
MTP support would allow connecting devices much like a MSD.

I am not sure that I understand the need. I can connect my android phone as a MSD device, if I want to bother doing it. WiFi is easier, and the speed is reasonable.

To make it even easier, Lenovo has a program, available to all, called ShareIt. It doesn't run in native OS/2, but it does run under windows (as well as Android and IOS, including windows in VBox). See: http://shareit.lenovo.com/. It says it uses WiFi, but it also uses wired connections, or even VBox to host networks. The "worst" part about it is that they keep changing the user interface, but it is usually not too difficult to figure it out.

Perhaps the code is available for ShareIt???

Greggory Shaw

  • Sr. Member
  • ****
  • Posts: 442
  • Karma: +0/-0
    • View Profile
Re: MTP plugin for Netdrive?
« Reply #6 on: June 26, 2016, 11:26:11 pm »
I just tried mediatomb, dies with,
Quote
2016-06-26 10:22:12    INFO: Configuration check succeeded.
2016-06-26 10:22:12   ERROR: main: upnp error -208
2016-06-26 10:22:12   ERROR: Socket error.
2016-06-26 10:22:12    INFO: Please check if your network interface was configured for multicast!
2016-06-26 10:22:12    INFO: Refer to the README file for more information.
2016-06-26 10:22:12   ERROR: upnp_cleanup: UpnpUnRegisterRootDevice failed

F:\mediatomb\bin>ifconfig lan0
lan0: flags=bc63<UP,BROADCAST,NOTRAILERS,RUNNING,DEFMTU,MULTICAST,BRIDGE,SNAP,LOOPBRD>
        inet 192.168.0.2  netmask 0xffffff00 broadcast 192.168.0.255

MTP support would allow connecting devices much like a MSD. Currently here I can unmount the microsd card, risk losing it, plug it into an adapter and then into my OS/2 computers USB port and transfer files that way, or use FTP. FTP is slow over the wireless and the moving microsd card is a bit of a hassle

Hi Dave,

I think this should help - http://www.os2world.com/forum/index.php/topic,705.msg6657.html#msg6657


Greggory
« Last Edit: June 26, 2016, 11:30:28 pm by Greggory Shaw »

Dave Yeo

  • Hero Member
  • *****
  • Posts: 4786
  • Karma: +99/-1
    • View Profile
Re: MTP plugin for Netdrive?
« Reply #7 on: June 27, 2016, 12:19:03 am »
Thanks Greggory

@Doug, being able to connect devices as a MSD device is going away. My Android tablet doesn't allow it. The reason given is to prevent race conditions, eg 2 devices writing to the same file, which is a consideration but the other reason is to limit what you can access. Can't have you copying stuff that the powers that be say not to.
As for wi-fi, here my computer is on the other side of the wireless router so some things just don't work and even those that do, I have to use my 207.xxx.xxx.xxx external address which is always changing, rather then my 192.168.0.x address that I've assigned to my lan card.
I'll follow Greggory's link.

Paul Smedley

  • Hero Member
  • *****
  • Posts: 2092
  • Karma: +159/-0
    • View Profile
Re: MTP plugin for Netdrive?
« Reply #8 on: June 27, 2016, 04:08:34 am »
Thanks guys, I'll look at getting a build of the libmtp command line tools first, as this would form the core of any netdrive plugin.

I tried testing this morning with a Nexus tablet and virtualbox, and got a USB error - Ill see if I can test with native hardware tonight. Not sure if something has changed with libusb or its just a virtualbox usb issue....

Doug Bissett

  • Hero Member
  • *****
  • Posts: 1593
  • Karma: +4/-2
    • View Profile
Re: MTP plugin for Netdrive?
« Reply #9 on: June 27, 2016, 06:51:48 am »
Quote
Can't have you copying stuff that the powers that be say not to.

There will always be a way to do it.

Quote
As for wi-fi, here my computer is on the other side of the wireless router so some things just don't work and even those that do, I have to use my 207.xxx.xxx.xxx external address which is always changing, rather then my 192.168.0.x address that I've assigned to my lan card.

You do have an "unusual" internet connection. There may be a way to work around that, but it could be more work than it is worth.

Paul Smedley

  • Hero Member
  • *****
  • Posts: 2092
  • Karma: +159/-0
    • View Profile
Re: MTP plugin for Netdrive?
« Reply #10 on: July 03, 2016, 11:05:12 am »
Thanks guys, I'll look at getting a build of the libmtp command line tools first, as this would form the core of any netdrive plugin.

I tried testing this morning with a Nexus tablet and virtualbox, and got a USB error - Ill see if I can test with native hardware tonight. Not sure if something has changed with libusb or its just a virtualbox usb issue....

http://smedley.id.au/tmp/libmtp-1.1.11.zip contains a built of libmtp 1.1.11 - requires libusb10.dll from my website

Note: this build wasn't working for me when I tested a few nights ago on my T60. I did have this kinda working back in 2013 - so not sure if it's a USB stack issue on my T60 (stack not updated in a long time) or if it's a libusb issue - or even a change in usbresmg.sys...

Here, it detects the device connected, but times out when making a connection when running mtp-detect.exe Curious what others see...

Please test with the logging libusb10.dll from the zip at http://os2ports.smedley.id.au/index.php?page=libusb-1-0 and post a log excerpt to see if it's the same as I get here...
« Last Edit: July 03, 2016, 11:07:56 am by Paul Smedley »

David McKenna

  • Hero Member
  • *****
  • Posts: 742
  • Karma: +24/-0
    • View Profile
Re: MTP plugin for Netdrive?
« Reply #11 on: July 03, 2016, 01:54:59 pm »
 I tried MTP-DETECT using the logging dll and Lars' USB drivers ver 206 with a Galaxy Note4. It hangs for about a minute at one point, then continues with errors. Tried to capture a log (mtp-detect > usb.log) and got the attached file, but its contents are not what appeared on the console... how do I capture the console contents?

Dave Yeo

  • Hero Member
  • *****
  • Posts: 4786
  • Karma: +99/-1
    • View Profile
Re: MTP plugin for Netdrive?
« Reply #12 on: July 03, 2016, 06:34:12 pm »
@David, you need to capture stdout and stderr, I used this command
mtp-detect 2>&1 | tee mtp-detect.log
and got this.
Code: [Select]
Device 0 (VID=2207 and PID=0001) is a Various Viewpia DR/bq Kepler.
libusb_detach_kernel_driver() failed, continuing anyway...: Error 0
PTP_ERROR_IO: failed to open session, trying again after resetting USB interface
LIBMTP libusb: Attempt to reset device
libusb_detach_kernel_driver() failed, continuing anyway...: Error 0
LIBMTP PANIC: failed to open session on second attempt
Unable to open raw device 0
libmtp version: 1.1.11

Listing raw device(s)
   Found 1 device(s):
   Various: Viewpia DR/bq Kepler (2207:0001) @ bus 1, dev 3
Attempting to connect device(s)
Clearing stall on OUT endpoint
OK.

This is also the same output I get from my attempt to build libmtp with a newer libusb.dll

Dave Yeo

  • Hero Member
  • *****
  • Posts: 4786
  • Karma: +99/-1
    • View Profile
Re: MTP plugin for Netdrive?
« Reply #13 on: July 03, 2016, 06:56:54 pm »
Here's the output with the logging dll

David McKenna

  • Hero Member
  • *****
  • Posts: 742
  • Karma: +24/-0
    • View Profile
Re: MTP plugin for Netdrive?
« Reply #14 on: July 03, 2016, 09:06:50 pm »
 Thanks, Dave! New log attached. I added the line <HANG> at the point the hang occurs.