OS2 World Community Forum
OS/2, eCS & ArcaOS - Technical => Storage => Topic started by: Paul Smedley 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
-
YES, absolutely interested, for the very reason you mentioned: mobile devices!
-
I would definitely find it useful and could help test on real hardware if needed.
-
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 (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).
-
I just tried mediatomb, dies with,
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
-
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.
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/ (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???
-
I just tried mediatomb, dies with,
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
-
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.
-
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....
-
Can't have you copying stuff that the powers that be say not to.
There will always be a way to do it.
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.
-
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...
-
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?
-
@David, you need to capture stdout and stderr, I used this command
mtp-detect 2>&1 | tee mtp-detect.log
and got this.
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
-
Here's the output with the logging dll
-
Thanks, Dave! New log attached. I added the line <HANG> at the point the hang occurs.
-
Hi Guys,
Thanks, Dave! New log attached. I added the line <HANG> at the point the hang occurs.
OK - this is the same as I'm seeing here. That's actually useful, as it save me wasting a bunch of time trying new usb stacks, etc.
I just wish I knew what was different back when I had this kinda working back in 2013 :) I suspect some change in the libusb code trying to fix issues with either lsusb or cups.
I''ll try get back onto this when I have some free time again.
Cheers,
Paul
-
I bought a Moto E (2nd gen) and once again the documentation claimed it works as a mass storage device (MSD) but there are no settings to allow it.
So first I test PTP mode, camerdarie sees photos fine on it, unlike my cheap tablet.
I then recompiled libmtp with the latest libusb and MTP mode also works, at least for one shot. I can turn off MTP mode and turn it back on and once again it seems to work for one shot.
I then retested with Paul's build and it seems to work the same. I have to figure out how to transfer a file with the example programs but it does list all the files using mtp-files.exe.
I'll continue playing it tonight.
BTW, tablet is still the same so I don't think using the latest Lars USB drivers did the trick, just slightly different implementation.
Here's the log from mtp-detect.
-
Hey Dave,
I bought a Moto E (2nd gen) and once again the documentation claimed it works as a mass storage device (MSD) but there are no settings to allow it.
So first I test PTP mode, camerdarie sees photos fine on it, unlike my cheap tablet.
I then recompiled libmtp with the latest libusb and MTP mode also works, at least for one shot. I can turn off MTP mode and turn it back on and once again it seems to work for one shot.
I then retested with Paul's build and it seems to work the same. I have to figure out how to transfer a file with the example programs but it does list all the files using mtp-files.exe.
I'll continue playing it tonight.
BTW, tablet is still the same so I don't think using the latest Lars USB drivers did the trick, just slightly different implementation.
Here's the log from mtp-detect.
I need to find some time to get back onto this project.... I have 3 weeks vacation over Christmas, hopefully then :)
Cheers,
Paul
-
I looked into detect.log and I see starting on line 1883 :
libusb: 2.459000 debug [libusb_open] open 1.2
libusb: 2.459000 debug [os2_open] unable to open device - id= 22b8/2e82 rc= ff0c
libusb: 2.459000 debug [os2_open] open: rc = ff0c, fd -1
libusb: 2.459000 debug [os2_open] open, set device configuration: rc = ff37, fd -1
FF0C= ERROR_I24_GEN_FAILURE. The open fails because it has already been opened before.
FF37= ERROR_DEV_NOT_EXIST. The set configuration fails because of the invalid fd (-1) value.
I suspect that it would have worked with the fd value (35651590) of the outstanding open.
I wonder about the event reported in line 43:
libusb_detach_kernel_driver() failed, continuing anyway...: Error 0
May be thIs is causing the problem?
-
The kernel driver seems harmless, the code from libusb1-glue.c
/*
* If this device is known to be wrongfully claimed by other kernel
* drivers (such as mass storage), then try to unload it to make it
* accessible from user space.
*/
if (FLAG_UNLOAD_DRIVER(ptp_usb) &&
libusb_kernel_driver_active(device_handle, ptp_usb->interface)
) {
if (LIBUSB_SUCCESS != libusb_detach_kernel_driver(device_handle, ptp_usb->interface)) {
perror("libusb_detach_kernel_driver() failed, continuing anyway...");
}
}
Further experimentation shows that it doesn't always lose the device but need to do more experiments.
It would be nice to be able to transfer files over USB as currently I move the micro-sd card over to my computer to move files or use ftp. Ftp is slow for lots of small files and I'd like to make the SD card part of the main storage, which means reformatting it in such a way that it won't work for mass storage.
-
Hi Wim,
I looked into detect.log and I see starting on line 1883 :
libusb: 2.459000 debug [libusb_open] open 1.2
libusb: 2.459000 debug [os2_open] unable to open device - id= 22b8/2e82 rc= ff0c
libusb: 2.459000 debug [os2_open] open: rc = ff0c, fd -1
libusb: 2.459000 debug [os2_open] open, set device configuration: rc = ff37, fd -1
FF0C= ERROR_I24_GEN_FAILURE. The open fails because it has already been opened before.
FF37= ERROR_DEV_NOT_EXIST. The set configuration fails because of the invalid fd (-1) value.
I suspect that it would have worked with the fd value (35651590) of the outstanding open.
I wonder about the event reported in line 43:
libusb_detach_kernel_driver() failed, continuing anyway...: Error 0
May be thIs is causing the problem?
The comment about ff0c is useful. Probably (it's been a while since I looked at libusb), os2_open is setting fd to -1 based on rc not being 0. There probably needs to be a case where there are other acceptable rc's that should not indicate an error.
afair libusb_detach_kernel_driver is just a stub.
Cheers,
Paul
-
I also successfully transferred a few files to the phone. While it takes a while (a minute or more) to make contact, once the file is transferring, it is very quick, much quicker then transferring using FAT32. Repeat file copying works fine without having to reset the device.
Have to copy mtp.connect.exe to mtp.sendfiles.exe (also mtp-delfiles.exe mtp-newfolder.exe mtp-sendtr.exe) as they are symlinked on make install.
This is using my build. The only patching I did was fix a bashism in configure and added __OS2__ to a couple of places where O_BINARY was set for windows.
-
Hi Guys,
Hi Wim,
I looked into detect.log and I see starting on line 1883 :
libusb: 2.459000 debug [libusb_open] open 1.2
libusb: 2.459000 debug [os2_open] unable to open device - id= 22b8/2e82 rc= ff0c
libusb: 2.459000 debug [os2_open] open: rc = ff0c, fd -1
libusb: 2.459000 debug [os2_open] open, set device configuration: rc = ff37, fd -1
FF0C= ERROR_I24_GEN_FAILURE. The open fails because it has already been opened before.
FF37= ERROR_DEV_NOT_EXIST. The set configuration fails because of the invalid fd (-1) value.
I suspect that it would have worked with the fd value (35651590) of the outstanding open.
I wonder about the event reported in line 43:
libusb_detach_kernel_driver() failed, continuing anyway...: Error 0
May be thIs is causing the problem?
The comment about ff0c is useful. Probably (it's been a while since I looked at libusb), os2_open is setting fd to -1 based on rc not being 0. There probably needs to be a case where there are other acceptable rc's that should not indicate an error.
http://smedley.id.au/tmp/libusb10.zip ignores ff0c - perhaps it will help with your tablet Dave?
[code
rc = UsbOpen( (PUSBHANDLE)&usbhandle,
(USHORT)dpriv->ddesc.idVendor,
(USHORT)dpriv->ddesc.idProduct,
(USHORT)dpriv->ddesc.bcdDevice,
(USHORT)USB_OPEN_FIRST_UNUSED);
if (rc && rc != ERROR_I24_GEN_FAILURE) {
usbi_dbg( "unable to open device - id= %x/%x rc= %x",
dpriv->ddesc.idVendor,
dpriv->ddesc.idProduct, (int)rc);
usbhandle = -1;
rtn = -1;
}
[/code]
Cheers,
Paul
-
Not much different. Log attached.