[python-win32] Does pywin32 support SD card operation(IOCTL_SFFDISK_QUERY_DEVICE_PROTOCOL)?
Jane Chen
janechen_1979 at yahoo.com
Wed Jul 18 19:37:39 CEST 2012
Jane Chen wrote:
>
> Thank you for your help. However, I still got pywintypes.error: (50,
> "DeviceIoControl", "The request is not supported").
>
> I added the following codes to winioctlcon.py <http://winioctlcon.py/>.
You should not probably modify the standard library files, because
you'll lose the change when you upgrade. You should add this to your
own file.
>
> I added the following codes to my script
> import win32con, winioctlcon
> """
> Definition of buffer used with _SFFDISK_QUERY_DEVICE_PROTOCOL_DATA:
> typedef struct _SFFDISK_QUERY_DEVICE_PROTOCOL_DATA {
> USHORT Size;
> USHORT Reserved;
> GUID ProtocolGUID;
> }
> """
> buf_fmt='HHs0L'
> buf_size=struct.calcsize(buf_fmt)
Your buf_fmt is not correct. GUID is not a string, it is a 16-byte
binary GUID. You want 'HHLLLL' -- the buf_size should be 20. Plus, you
really don't want "struct" to unpack the GUID. It doesn't know that type.
Thank you for your help.
Could you please help me write better codes for GUID?
However, that's not your fundamental problem. My guess is that you are
trying to call this for an SD disk that is plugged into a USB adapter.
If so, that won't work, because the operating system doesn't see it as
an SD disk, it sees it as a USB disk. It has to be an SD drive
connected directly to a PCI bus, and those are usually only found on
laptops. The error message is exactly right -- the request is not
supported.
You are right. I was using USB.
Based on your suggestion, I connected the SD drive directly to a PCI bus and set buf_fmt='HHLLLL'. However, I got another error message: (1, 'DeviceIoControl', 'Incorrect function'). I think I did not use the function correctly.
Best,
Jane
--
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20120718/c0abb737/attachment.html>
More information about the python-win32
mailing list