Page 1 of 1
DeviceHandle does not work for all devices [#11993]
Posted: Tue Apr 02, 2013 3:37 am
by ceinj
MM 4.1.0.1629 on XP and Windows 7. I have a vbs script that uses the new DeviceHandle call but it doesn't report many connected devices. I had an iPhone, HTC (Android) and a Thumbdrive connected to the computers. MM showed these devices in its tree but only the DeviceHandle for the iPhone returned a value other than -1.
Also calling the function/property takes a long time (just a precautionary warning to scripters).
Re: (Scripting) DeviceHandle does not work for all devices
Posted: Fri Apr 05, 2013 3:15 am
by Ludek
You seem to be right,
it works for my Android phone in MTP mode, for iPhone, but doesn't work for my USB stick (with assigned drive letter), I guess this is case for your devices?
I will fix it as
http://www.ventismedia.com/mantis/view.php?id=10708
Re: (Scripting) DeviceHandle does not work for all devices
Posted: Mon Apr 08, 2013 9:17 pm
by ceinj
Yea! The new version fixes the problem and seems to be much faster.
Thanks!
Re: (Scripting) DeviceHandle does not work for all devices
Posted: Sat Oct 26, 2013 1:58 am
by ceinj
New issue found. Running version 4.1.0.1664. I plug in an Android phone and two devices show up in MM (phone and SD card). I verified I can sync to both devices using MM manually. When I try writing a script it seems that there is only a single "DeviceHandle" for this device and there is no way to copy to the SD card.
Re: (Scripting) DeviceHandle does not work for all devices
Posted: Fri Nov 01, 2013 9:02 am
by Ludek
Hi, so if you use example code here
http://www.mediamonkey.com/wiki/index.p ... viceHandle to enumerate them then only one device is in the list?
i.e. SD Card and Phone have same VID and PID, but if you use something like (with your device VID/PID)
Code: Select all
Dim Devices : Set Devices = SDB.Device.ActiveDeviceList("VID_04E8&PID_6860")
then
, isn't it?
Re: (Scripting) DeviceHandle does not work for all devices
Posted: Mon Nov 04, 2013 2:52 am
by ceinj
Both examples seem the same! They both return a device count of 2 but only 1 has a valid DeviceHandle.
Re: (Scripting) DeviceHandle does not work for all devices
Posted: Mon Nov 04, 2013 9:29 am
by Ludek
Strange, I don't see a reason for it.
So both SDCard and Phone are returned in the list, but SDcard has DeviceHandle = -1 ?
Which phone model it is?
If you try to initiate playback of tracks on the device from MM interface (Media Tree -> SD card -> Music...), do they play?
Re: (Scripting) DeviceHandle does not work for all devices
Posted: Mon Nov 04, 2013 11:45 pm
by ceinj
The phone is a Samsung Galaxy Victory 4G LTE. In MM I have been able to copy different selections to the phone and the SD card and verified playback.
To clear up any misstatements I may have made, I wrote a small script to dump the device handle and other device information. Code snippet and results are below.
Code: Select all
Dim list : Set list = SDB.Device.ActiveDeviceList("VID_04E8&PID_6860")
If list.Count = 0 Then
Call SDB.MessageBox(SDB.Localize("No active devices. [1]"),mtError,Array(mbOk))
Exit Sub
End If
Dim inds : inds = ""
Dim nams : nams = ""
Dim boo : boo = False
Dim txt
Dim i : i = 0
For i = 0 To list.Count-1
txt = ">>Dev " & i & " ID [" & list.DeviceID(i) & "] Device Count = " & list.Count & " Handle [" & list.DeviceHandle(i) & "]"
Call fout.WriteLine(txt)
If list.DeviceHandle(i) > -1 Then
Dim indx : indx = list.DeviceID(i)
Dim sqls : sqls = "SELECT DeviceCaption,DetailedUSBID FROM Devices WHERE DetailedUSBID LIKE '%"&indx&"%'"
Dim iter : Set iter = SDB.Database.OpenSQL(sqls)
While Not iter.EOF
txt = " Detail Caption [" & iter.StringByIndex(0) & "]"
Call fout.WriteLine(txt)
txt = " USB ID [" & iter.StringByIndex(1) & "]"
Call fout.WriteLine(txt)
iter.Next
Wend
Set iter = Nothing
End If
Next
Call fout.Close()
========== Results Below =============
>>Dev 0 ID [USB\VID_04E8&PID_6860\5014B028] Device Count = 1 Handle [49863440]
Detail Caption [SPH-L300 - Phone]
USB ID [Orig:USB\VID_04E8&PID_6860\5014B028
Found:USB\VID_04E8&PID_6860\5014B028
]
Detail Caption [SPH-L300 - Card]
USB ID [Orig:USB\VID_04E8&PID_6860\5014B028
Found:USB\VID_04E8&PID_6860\5014B028
]
Re: (Scripting) DeviceHandle does not work for all devices
Posted: Tue Nov 05, 2013 10:43 am
by Ludek
OK, so the issue is that the (Device Count = 1), I should have similar phone for testing next week so I am going to see If I can replicate.
Re: (Scripting) DeviceHandle does not work for all devices
Posted: Thu Nov 12, 2015 8:08 am
by Peke
This should be better handled in 4.1.10.1765