diff --git a/src/userland/usbStorage/include/storage.h b/src/userland/usbStorage/include/storage.h index da49ead..76c4f30 100644 --- a/src/userland/usbStorage/include/storage.h +++ b/src/userland/usbStorage/include/storage.h @@ -6,7 +6,6 @@ typedef struct { uint32_t serviceId; uint32_t deviceId; - uint32_t getType; } StorageDevice; #endif // STORAGE_H \ No newline at end of file diff --git a/src/userland/usbStorage/include/storage.h b/src/userland/usbStorage/include/storage.h index da49ead..76c4f30 100644 --- a/src/userland/usbStorage/include/storage.h +++ b/src/userland/usbStorage/include/storage.h @@ -6,7 +6,6 @@ typedef struct { uint32_t serviceId; uint32_t deviceId; - uint32_t getType; } StorageDevice; #endif // STORAGE_H \ No newline at end of file diff --git a/src/userland/usbStorage/main.c b/src/userland/usbStorage/main.c index 4d623da..953c029 100644 --- a/src/userland/usbStorage/main.c +++ b/src/userland/usbStorage/main.c @@ -10,11 +10,9 @@ void setup(uint32_t in, uint32_t out, uint32_t serviceName, uint32_t serviceId) { - StorageDevice *device = malloc(sizeof(StorageDevice)); - device->serviceId = serviceId; - device->getType = getFunction(serviceId, "get_type"); - UsbInterfaceType typeIn = { .value = request(serviceId, device->getType, in, 0) }; - UsbInterfaceType typeOut = { .value = request(serviceId, device->getType, out, 0) }; + uint32_t getType = getFunction(serviceId, "get_type"); + UsbInterfaceType typeIn = { .value = request(serviceId, getType, in, 0) }; + UsbInterfaceType typeOut = { .value = request(serviceId, getType, out, 0) }; if (typeIn.value != typeOut.value) { printf("something went wrong when assigning the in and out pipes, aborting...\n"); return; @@ -43,6 +41,12 @@ case 0x62: printf("protocol: UAS\n"); break; default: printf("protocol: unknown\n"); break; } + if (typeIn.types.protocol != 0x50) { + printf("only bulk only protocol supported for now, aborting...\n"); + return; + } + StorageDevice *device = malloc(sizeof(StorageDevice)); + device->serviceId = serviceId; printf("in: %x, out: %x, typeIn: %x, typeOut: %x\n", in, out, typeIn, typeOut); }