Sebastian Friebe wrote:
> I'm trying to get access to a USB mass storage device in order to send
> low-level SCSI commands, like TEST_UNIT_READY and REQUEST_SENSE.
> I'm looking for a pure Python solution using the deviceIOcontrol
> function out of the win32file package.
>
> Does anyone has experience with it?
>
> I heared about libusb_win32 and pyUSB, but I couldn't figure out if
> these are really required. I guess these packages are needed just in
> case you want to do higher level operations in an application, right?

This can't be done as you have described it.

The problem is that the SCSI-like command set is only used between the
USB mass storage driver (usbstor.sys) and the USB host controller
driver.  Above usbstor.sys, the device looks like a standard mass
storage device.  There are no hooks in usbstor.sys to allow you to send
commands like this, nor does usbstor.sys allow you to send USB packets
directly.  Neither libusb-win32 nor pyUSB will help, because there is
already a driver handling the device.  libusb installs its own generic
driver, but it can't install a driver if another one has already claimed
the device.

Theoretically, you could write an INF file to force your device to be
claimed by libusb's driver, and then use libusb commands to talk to the
device.  You would then be in COMPLETE control of the device.  However,
that also means it won't be recognized as a mass storage device.  It
will just be a generic USB device.

It may be that the easiest course of action for you is to write a lower
filter driver to sit between usbstor.sys and USBD, and have it expose a
"control" device object.  Such a thing CAN be opened and manipulated
using the win32file APIs.

Do you have any driver experience at your shop?

-- 
Tim Roberts, [EMAIL PROTECTED]
Providenza & Boekelheide, Inc.

_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to