The switch_command is a USB storage message, the bulk_cb_wrap structure
from include/linux/usb/storage.h in the Linux kernel shows the fields
meanings:
struct bulk_cb_wrap {
__le32 Signature; /* contains 'USBC' */
__u32 Tag; /* unique per command id */
__le32 DataTransferLength; /* size of data */
__u8 Flags; /* direction in bit 0 */
__u8 Lun; /* LUN normally 0 */
__u8 Length; /* length of the CDB */
__u8 CDB[16]; /* max command */
};
In switch_command the data in CDB is 16 bytes long (0x10), so using 0x0c
was wrong, it worked on some devices but it did not on others.
Use the correct value.
Thanks-to: Balasubramanian S <sbala214@gmail.com>
static unsigned char switch_command[] =
"\x55\x53\x42\x43\x08\x70\x52\x89\x00\x00\x00\x00\x00\x00"
static unsigned char switch_command[] =
"\x55\x53\x42\x43\x08\x70\x52\x89\x00\x00\x00\x00\x00\x00"
- "\x0c\xff\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00";
+ "\x10\xff\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00";