2929
3030from mbed_lstools .windows import (MbedLsToolsWin7 , CompatibleIDsNotFoundException ,
3131 _get_cached_mounted_points , _is_mbed_volume , _get_values_with_numeric_keys ,
32- _get_volumes , _get_usb_storage_devices , _determine_valid_non_composite_devices ,
32+ _get_disks , _get_usb_storage_devices , _determine_valid_non_composite_devices ,
3333 _determine_subdevice_capability )
3434
3535class Win7TestCase (unittest .TestCase ):
@@ -70,25 +70,16 @@ def test_empty_reg(self):
7070 value_dict = {
7171 (None , 'SYSTEM\\ MountedDevices' ): [
7272 ('\\ DosDevices\\ F:' ,
73- u'_??_USBSTOR#Disk&Ven_SEGGER&Prod_MSD_Volume&Rev_1.00#8&1b8e102b&0&000440035522&0#{53f56307-b6bf-11d0-94f2-00a0c91efb8b}' .encode ('utf-16le' )),
74- ('\\ DosDevices\\ D:' ,
75- u'_??_USBSTOR#Disk&Ven_MBED&Prod_VFS&Rev_0.1#0240000032044e4500367009997b00086781000097969900&0#{53f56307-b6bf-11d0-94f2-00a0c91efb8b}' .encode ('utf-16le' )),
73+ u'_??_USBSTOR#Disk&Ven_MBED&Prod_VFS&Rev_0.1#9&215b8c47&0&0240000032044e4500257009997b00386781000097969900&0#{53f56307-b6bf-11d0-94f2-00a0c91efb8b}' .encode ('utf-16le' )),
7674 ],
7775 (None , 'SYSTEM\\ CurrentControlSet\\ Services\\ volume\\ Enum' ): [],
7876 (None , 'SYSTEM\\ CurrentControlSet\\ Services\\ USBSTOR\\ Enum' ): []
7977 }
80- key_dict = {
81- (None , 'SYSTEM\\ CurrentControlSet' ): ['Services\\ usbccgp\\ Enum' ],
82- (None , 'SYSTEM\\ CurrentControlSet' ): ['Enum\\ USB' ],
83- ((None , 'SYSTEM\\ CurrentControlSet' ), 'Enum\\ USB' ):
84- ['ROOT_HUB30' , 'VID_0416&PID_511E' , 'VID_0416&PID_511E&MI_00' ,
85- 'VID_0D28&PID_0204' , 'VID_0D28&PID_0204&MI_00' , 'VID_0D28&PID_0204&MI_04' ]
86- }
87- self .setUpRegistry (value_dict , key_dict )
78+ self .setUpRegistry (value_dict , {})
8879 candidates = self .lstool .find_candidates ()
8980 self .assertEqual (_winreg .OpenKey .mock_calls , [
9081 call (_winreg .HKEY_LOCAL_MACHINE , 'SYSTEM\\ MountedDevices' ),
91- call (_winreg .HKEY_LOCAL_MACHINE , 'SYSTEM\\ CurrentControlSet\\ Services\\ volume \\ Enum' ),
82+ call (_winreg .HKEY_LOCAL_MACHINE , 'SYSTEM\\ CurrentControlSet\\ Services\\ Disk \\ Enum' ),
9283 call (_winreg .HKEY_LOCAL_MACHINE , 'SYSTEM\\ CurrentControlSet\\ Services\\ USBSTOR\\ Enum' )
9384 ])
9485 self .assertEqual (candidates , [])
@@ -199,7 +190,7 @@ def test_get_cached_mount_points(self):
199190 self .assertEqual (_get_cached_mounted_points (), [])
200191
201192
202- def test_get_volumes (self ):
193+ def test_get_disks (self ):
203194 dummy_key = 'dummy_key'
204195 volume_strings = [
205196 'dummy_volume_1' ,
@@ -211,21 +202,21 @@ def test_get_volumes(self):
211202 _num_keys .return_value = volume_strings
212203 _is_mbed_volume .return_value = True
213204
214- result = _get_volumes ()
205+ result = _get_disks ()
215206
216207 _winreg .OpenKey .assert_called_once_with (_winreg .HKEY_LOCAL_MACHINE ,
217- 'SYSTEM\\ CurrentControlSet\\ Services\\ volume \\ Enum' )
208+ 'SYSTEM\\ CurrentControlSet\\ Services\\ Disk \\ Enum' )
218209 _num_keys .assert_called_once_with (dummy_key )
219210 self .assertEqual (result , volume_strings )
220211
221212 _winreg .OpenKey .reset_mock ()
222213 _winreg .OpenKey .side_effect = OSError
223214 _num_keys .reset_mock ()
224215
225- result = _get_volumes ()
216+ result = _get_disks ()
226217
227218 _winreg .OpenKey .assert_called_once_with (_winreg .HKEY_LOCAL_MACHINE ,
228- 'SYSTEM\\ CurrentControlSet\\ Services\\ volume \\ Enum' )
219+ 'SYSTEM\\ CurrentControlSet\\ Services\\ Disk \\ Enum' )
229220 _num_keys .assert_not_called ()
230221 self .assertEqual (result , [])
231222
@@ -350,20 +341,20 @@ def test_one_composite_dev(self):
350341 (None , 'SYSTEM\\ MountedDevices' ): [
351342 ('\\ DosDevices\\ C:' , u'NOT A VALID MBED DRIVE' .encode ('utf-16le' )),
352343 ('\\ DosDevices\\ F:' ,
353- u'_??_USBSTOR#Disk&Ven_MBED&Prod_VFS&Rev_0.1#0240000032044e4500367009997b00086781000097969900 &0#{53f56307-b6bf-11d0-94f2-00a0c91efb8b}' .encode ('utf-16le' ))
344+ u'_??_USBSTOR#Disk&Ven_MBED&Prod_VFS&Rev_0.1#9&215b8c47&0&0240000032044e4500257009997b00386781000097969900 &0#{53f56307-b6bf-11d0-94f2-00a0c91efb8b}' .encode ('utf-16le' ))
354345 ],
355- (None , 'SYSTEM\\ CurrentControlSet\\ Services\\ volume \\ Enum' ): [
356- ('0' , 'STORAGE \\ Volume \\ _??_USBSTOR# Disk&Ven_MBED&Prod_VFS&Rev_0.1#0240000032044e4500367009997b00086781000097969900&0#{53f56307-b6bf-11d0-94f2-00a0c91efb8b} ' )
346+ (None , 'SYSTEM\\ CurrentControlSet\\ Services\\ Disk \\ Enum' ): [
347+ ('0' , 'USBSTOR \\ Disk&Ven_MBED&Prod_VFS&Rev_0.1\\ 9&215b8c47&0&0240000032044e4500257009997b00386781000097969900&0 ' )
357348 ],
358349 (None , 'SYSTEM\\ CurrentControlSet\\ Services\\ USBSTOR\\ Enum' ): [
359350 ('0' , 'USB\\ VID_0D28&PID_0204&MI_00\\ 8&26b12a60&0&0000' )
360351 ],
361352 (None , 'SYSTEM\\ CurrentControlSet\\ Enum\\ USB\\ VID_0D28&PID_0204' ): [],
362353 (((None , 'SYSTEM\\ CurrentControlSet\\ Enum\\ USB\\ VID_0D28&PID_0204' ),
363- '0240000032044e4500367009997b00086781000097969900 ' ),
354+ '0240000032044e4500257009997b00386781000097969900 ' ),
364355 'ParentIdPrefix' ): ('8&26b12a60&0' , None ),
365356 (((None , 'SYSTEM\\ CurrentControlSet\\ Enum\\ USB\\ VID_0D28&PID_0204' ),
366- '0240000032044e4500367009997b00086781000097969900 ' ),
357+ '0240000032044e4500257009997b00386781000097969900 ' ),
367358 'CompatibleIDs' ): ([u'USB\\ DevClass_00&SubClass_00&Prot_00' , u'USB\\ DevClass_00&SubClass_00' , u'USB\\ DevClass_00' , u'USB\\ COMPOSITE' ], 7 ),
368359 (((None , 'SYSTEM\\ CurrentControlSet\\ Enum\\ USB\\ VID_0D28&PID_0204&MI_00' ), '8&26b12a60&0&0000' ), 'CompatibleIDs' ): ([u'USB\\ Class_08&SubClass_06&Prot_50' , u'USB\\ Class_08&SubClass_06' , u'USB\\ Class_08' ], 7 ),
369360 (((None , 'SYSTEM\\ CurrentControlSet\\ Enum\\ USB\\ VID_0D28&PID_0204&MI_01' ),
@@ -376,7 +367,7 @@ def test_one_composite_dev(self):
376367 }
377368 key_dict = {
378369 (None , 'SYSTEM\\ CurrentControlSet\\ Enum\\ USB\\ VID_0D28&PID_0204' ):
379- ['0240000032044e4500367009997b00086781000097969900 ' ],
370+ ['0240000032044e4500257009997b00386781000097969900 ' ],
380371 (None , 'SYSTEM\\ CurrentControlSet\\ Enum\\ USB\\ VID_0D28&PID_0204&MI_00' ): [],
381372 (None , 'SYSTEM\\ CurrentControlSet\\ Enum\\ USB\\ VID_0D28&PID_0204&MI_01' ): [],
382373 (((None , 'SYSTEM\\ CurrentControlSet\\ Enum\\ USB\\ VID_0D28&PID_0204&MI_01' ),
@@ -390,7 +381,7 @@ def test_one_composite_dev(self):
390381 expected_info = {
391382 'mount_point' : 'F:' ,
392383 'serial_port' : 'COM7' ,
393- 'target_id_usb_id' : u'0240000032044e4500367009997b00086781000097969900 '
384+ 'target_id_usb_id' : u'0240000032044e4500257009997b00386781000097969900 '
394385 }
395386
396387 devices = self .lstool .find_candidates ()
@@ -402,22 +393,22 @@ def test_one_non_composite_dev(self):
402393 (None , 'SYSTEM\\ MountedDevices' ): [
403394 ('\\ DosDevices\\ C:' , u'NOT A VALID MBED DRIVE' .encode ('utf-16le' )),
404395 ('\\ DosDevices\\ F:' ,
405- u'_??_USBSTOR#Disk&Ven_MBED&Prod_VFS&Rev_0.1#0000000032044e4500367009997b00086781000097969900 &0#{53f56307-b6bf-11d0-94f2-00a0c91efb8b}' .encode ('utf-16le' ))
396+ u'_??_USBSTOR#Disk&Ven_MBED&Prod_VFS&Rev_0.1#0000000032044e4500257009997b00386781000097969900 &0#{53f56307-b6bf-11d0-94f2-00a0c91efb8b}' .encode ('utf-16le' ))
406397 ],
407- (None , 'SYSTEM\\ CurrentControlSet\\ Services\\ volume \\ Enum' ): [
408- ('0' , 'STORAGE \\ Volume \\ _??_USBSTOR# Disk&Ven_MBED&Prod_VFS&Rev_0.1#0000000032044e4500367009997b00086781000097969900&0#{53f56307-b6bf-11d0-94f2-00a0c91efb8b} ' )
398+ (None , 'SYSTEM\\ CurrentControlSet\\ Services\\ Disk \\ Enum' ): [
399+ ('0' , 'USBSTOR\ Disk&Ven_MBED&Prod_VFS&Rev_0.1\\ 0000000032044e4500257009997b00386781000097969900&0 ' )
409400 ],
410401 (None , 'SYSTEM\\ CurrentControlSet\\ Services\\ USBSTOR\\ Enum' ): [
411- ('0' , 'USB\\ VID_0D28&PID_0204\\ 0000000032044e4500367009997b00086781000097969900 ' )
402+ ('0' , 'USB\\ VID_0D28&PID_0204\\ 0000000032044e4500257009997b00386781000097969900 ' )
412403 ],
413404 (None , 'SYSTEM\\ CurrentControlSet\\ Enum\\ USB\\ VID_0D28&PID_0204' ): [],
414- ((None , 'SYSTEM\\ CurrentControlSet\\ Enum\\ USB\\ VID_0D28&PID_0204\\ 0000000032044e4500367009997b00086781000097969900 ' ),
405+ ((None , 'SYSTEM\\ CurrentControlSet\\ Enum\\ USB\\ VID_0D28&PID_0204\\ 0000000032044e4500257009997b00386781000097969900 ' ),
415406 'CompatibleIDs' ): ([u'USB\\ Class_08&SubClass_06&Prot_50' , u'USB\\ Class_08&SubClass_06' , u'USB\\ Class_08' ], 7 )
416407 }
417408 key_dict = {
418409 (None , 'SYSTEM\\ CurrentControlSet\\ Enum\\ USB\\ VID_0D28&PID_0204' ):
419- ['0000000032044e4500367009997b00086781000097969900 ' ],
420- (None , 'SYSTEM\\ CurrentControlSet\\ Enum\\ USB\\ VID_0D28&PID_0204\\ 0000000032044e4500367009997b00086781000097969900 ' ): []
410+ ['0000000032044e4500257009997b00386781000097969900 ' ],
411+ (None , 'SYSTEM\\ CurrentControlSet\\ Enum\\ USB\\ VID_0D28&PID_0204\\ 0000000032044e4500257009997b00386781000097969900 ' ): []
421412 }
422413 self .setUpRegistry (value_dict , key_dict )
423414
@@ -426,7 +417,7 @@ def test_one_non_composite_dev(self):
426417 expected_info = {
427418 'mount_point' : 'F:' ,
428419 'serial_port' : None ,
429- 'target_id_usb_id' : u'0000000032044e4500367009997b00086781000097969900 '
420+ 'target_id_usb_id' : u'0000000032044e4500257009997b00386781000097969900 '
430421 }
431422
432423 devices = self .lstool .find_candidates ()
0 commit comments