[fixed] [JIRA MP1-2469] - DetectDrive method obsolete ? (1 Viewer)

azzuro

Test Group
  • Team MediaPortal
  • May 10, 2007
    9,950
    5,620
    France - IDF
    Home Country
    France France

    Hi
    MP VERSION : 1.3 SVN Alpha to Beta
    Windows 7

    Actually MP use GetDriveType function for search Drive on System. but i think is obsolete with all USB HardDrive sold today !
    Code:
    Extracted from Util.cs
    	public static int getDriveType(string drive)
    	{
    	  if (drive == null) return 2;
    	  if ((GetDriveType(drive) & 5) == 5) return 5; //cd
    	  if ((GetDriveType(drive) & 3) == 3) return 3; //fixed
    	  if ((GetDriveType(drive) & 2) == 2) return 2; //removable
    	  if ((GetDriveType(drive) & 4) == 4) return 4; //remote disk
    	  if ((GetDriveType(drive) & 6) == 6) return 6; //ram disk
    	  return 0;
    	}
    The problem is this function is not compatible with External HardDrive, because are detected as fixed disk and not Removable drive, and not display in MP list ( Myvidéo / My music) This is display only one time when plug-in !
    Can you Addon support of WMI with GetWmiInfo Function ...
    PATCH from Deda & Sebastiii

    EDIT :
    2013 04 07 : Added to mantis
    http://mantis.team-mediaportal.com/view.php?id=4340
     

    Attachments

    • 0001-WMI-DetectDriver-Deda-Patch.patch
      22.1 KB
    Last edited:

    Deda

    Lead Dev MP1 Videos
  • Premium Supporter
  • March 18, 2009
    2,423
    2,385
    Zagreb
    Home Country
    Croatia Croatia
    I personally made for myself patch which resolves that but WindowsXp is not supported because it handles this differently.

    Does this will be in in 1.3.0, dunno but for now this is on ice because this will further delay 1.3.0 release and patch, even it is more or less trivial, change MP core so it's not very safe to use it before wide and careful test.
     
    Last edited:

    azzuro

    Test Group
  • Team MediaPortal
  • May 10, 2007
    9,950
    5,620
    France - IDF
    Home Country
    France France
    • Thread starter
    • Moderator
    • #3
    Hi Deda,

    i'm happy to see you !

    i would try to change this feature, but i'm not very sure about me !
    i must understand A to Z link ...
    1st : detect function for auto-detect drive, ( replace GetDriveType)
    2nd : how to translate information to MP.

    Very simple with Words ! many ideas, but nothing for make !
     

    Deda

    Lead Dev MP1 Videos
  • Premium Supporter
  • March 18, 2009
    2,423
    2,385
    Zagreb
    Home Country
    Croatia Croatia
    These are the patched files against current GIT master for USB HDD support (Win7 only)
     

    Attachments

    • WMI_WIN7_PatchedFiles.rar
      99.8 KB

    azzuro

    Test Group
  • Team MediaPortal
  • May 10, 2007
    9,950
    5,620
    France - IDF
    Home Country
    France France
    • Thread starter
    • Moderator
    • #5
    Thx for your files
    but, Can you add patch file ?
    In your patch, you have forced letter as removable drive ?
    WMi Info is not included in XP ?
     
    Last edited:

    Deda

    Lead Dev MP1 Videos
  • Premium Supporter
  • March 18, 2009
    2,423
    2,385
    Zagreb
    Home Country
    Croatia Croatia
    Thx for your files
    but, Can you add patch file ?
    In your patch, you have forced letter as removable drive ?
    WMi Info is not included in XP ?


    It's just plug&play, drive letter is from Windows (behavior is just like USB thumb and MP do not need to be running to recognize USB HDD and is visible in all plugins).

    Windows XP reports USB HDD as removable media and with this method we can't determine is it USB HDD or something else (Vista and above reports as External HDD media):
    Win32_DiskDrive class

    MediaType
    Data type: string
    Access type: Read-only

    Type of media used or accessed by this device.

    Starting with Windows Vista, possible values are:
    External hard disk media
    Removable media other than floppy
    Fixed hard disk media
    Format is unknown

    Windows Server 2003, Windows XP, Windows 2000, and Windows NT 4.0: Possible values are:​
    Removable media
    Fixed hard disk
    Unknown

    I don't have XP (and personally, XP should be in deserved retirement today) so I made this just for Vista/Win7 for personal use.
     

    Attachments

    • WMI_Win7_Patch.patch
      22.9 KB

    azzuro

    Test Group
  • Team MediaPortal
  • May 10, 2007
    9,950
    5,620
    France - IDF
    Home Country
    France France
    • Thread starter
    • Moderator
    • #8
    I don't have XP (and personally, XP should be in deserved retirement today) so I made this just for Vista/Win7 for personal use.
    I Agree with you, XP is obsolete now with no support DXVA2 and all plugNplay function ... and now win8 out ...

    I think is good to make 1.3 only compatible with Win7 Vista or older / with all .net function, now .net 4.5 not support XP
     
    Last edited:

    azzuro

    Test Group
  • Team MediaPortal
  • May 10, 2007
    9,950
    5,620
    France - IDF
    Home Country
    France France
    • Thread starter
    • Moderator
    • #9
    Tested 10 min, on W7-64b no problem,
    i can try XP only at work but i have forgotten the installation file (Can you post Exe file for this change, i can't compile where i am).

    if a Feature missing , i think is "Safely remove drive" function.

    USB flash media don't have icon : normally ? ( Tested with the New Default skin)
     

    azzuro

    Test Group
  • Team MediaPortal
  • May 10, 2007
    9,950
    5,620
    France - IDF
    Home Country
    France France
    • Thread starter
    • Moderator
    • #10
    Hi Deda, problem "from" your patch about WMI, conflict with tvplugin. for compil ClientPlugin
    this work for you ?
    Erreur 4 Le type 'System.Management.ManagementObjectSearcher' est défini dans un assembly qui n'est pas référencé. Vous devez ajouter une référence à l'assembly 'System.Management, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. D:\svnroot\GIT\MediaPortal-1\TvEngine3\TVLibrary\TvPlugin\TvPlugin\TvRecorded.cs 780 15 TvPlugin

    -----------------------

    Erreur 5 L'appel est ambigu entre les méthodes ou propriétés suivantes : 'MediaPortal.Util.WmiExtensions.First(System.Management.ManagementObjectSearcher)' et 'System.Linq.Enumerable.First<TvDatabase.Recording>(System.Collections.Generic.IEnumerable<TvDatabase.Recording>)' D:\svnroot\GIT\MediaPortal-1\TvEngine3\TVLibrary\TvPlugin\TvPlugin\TvRecorded.cs 780 92 TvPlugin
     
    Last edited:

    Users who are viewing this thread

    Top Bottom