Sure, my code isn't correct, as it tests only one name or ProductName.
I would like to be able to distinguish between Mass Storage devices and 
others (Keypad, mouse, cam, ...).

How could I achieve this?

Thanks

Jean-Luc

Le 28/03/2014 15:53, Jean-Luc Arnaud a écrit :
> Replying to myself.
>
> I finally found this in the documentation:
>
> // iterate over all devices without recursion and count devices
> dim devices(-1) as MacUSBDeviceMBS
> devices.Append MacUSBDeviceMBS.root
> dim count as integer = -1 // do not count Mac itself
>
> while UBound(devices)>=0
>       dim dev as MacUSBDeviceMBS = devices.Pop
>       count = count + 1
>       for each child as MacUSBDeviceMBS in dev.children
>           devices.Append child
>       next
> wend
>
> MsgBox str(Count)+” USB devices.”
>
> and modified it as below (in the Open event of a ListBox):
>
>     // iterate over all devices without recursion and count devices
>
>     dim devices(-1) as MacUSBDeviceMBS
>     dim USBDisk(-1) As MacUSBDeviceMBS
>     dim count as integer = -1 // do not count Mac itself
>
>     devices.Append MacUSBDeviceMBS.root
>
>     while UBound(devices)>=0
>       dim dev as MacUSBDeviceMBS = devices.Pop
>       count = count + 1
>
>       for each child as MacUSBDeviceMBS in dev.children
>         devices.Append child
>         If child.ProductName="Mass Storage Device" Or child.Name="Mass
> Storage Device" Then USBDisk.Append child
>       next
>     wend
>     'MsgBox str(Count)+" USB devices, dont "+Str(USBDisk.Ubound+1)+"
> périphériques de stockage."
>
>     For each dev As MacUSBDeviceMBS in USBDisk
>       Me.AddRow Str(dev.VendorID)
>       Me.Cell(Me.LastIndex,1)=dev.VendorName
>       Me.Cell(Me.LastIndex,2)=Str(dev.ProductID)
>       Me.Cell(Me.LastIndex,3)=dev.ProductName
>       Me.Cell(Me.LastIndex,4)=dev.SerialNumber
>     Next
>
> Is this a correct code? May I write something more efficient?
>
> TIA
>
> Jean-Luc
>
> Le 28/03/2014 15:13, Jean-Luc Arnaud a écrit :
>> Hi all,
>>
>> I'm working on USB devices (as Mass Storage).
>>
>> I found, in the examples, WinUSBDeviceMBS.devices that is listing all
>> USB devices on Windows.
>> Unfortunately, unless I'm wrong, MacUSBDeviceMBS.devices does not exist.
>>
>> How may I get a listing of all USB Mass Storage devices on Mac OS X?
>>
>> TIA
>>
>> Jean-Luc
>>
>> _______________________________________________
>> Mbsplugins_monkeybreadsoftware.info mailing list
>> [email protected]
>> https://ml01.ispgateway.de/mailman/listinfo/mbsplugins_monkeybreadsoftware.info
>>
>>
>


-- 
Jean-Luc Arnaud
Directeur Technique


Centre Direct du Multimedia

BP 80032
5 rue du 8 Mai 1945
91470 - LIMOURS - FRANCE

Siret 403 860 034 000 20 / Evry

  

Tel : 33 (0)1 64 91 46 24
Fax : 33 (0)1 64 91 46 87
mailto:[email protected]
http://www.cdmultimedia.fr

Notre spécialité : Transfert de tous formats vidéo vers un format numérique 
DVD, AVI, QuickTime, …
Montage et authoring de DVD, archivage de vidéo et audio.
Duplication de petites séries et de grandes séries de CD et DVD
Matériel et prestation de duplication de clés USB, FlashCards, disquettes, …
Développement Mac et PC à façon.


_______________________________________________
Mbsplugins_monkeybreadsoftware.info mailing list
[email protected]
https://ml01.ispgateway.de/mailman/listinfo/mbsplugins_monkeybreadsoftware.info

Reply via email to