mirror of
https://github.com/ErnyTech/Open-USB-Extreme
synced 2025-01-15 13:07:33 +01:00
30 lines
798 B
D
30 lines
798 B
D
module dusbextreme;
|
|
import std.stdint;
|
|
|
|
enum USBEXTREME_NAME_LENGTH = 32;
|
|
enum USBEXTREME_ID_LENGTH = 15;
|
|
enum USBEXTREME_NAME_EXT_LENGTH = 10;
|
|
enum USBEXTREME_MAGIC = 0x08;
|
|
enum USBEXTREME_HEADER_SIZE = usb_extreme_base.sizeof;
|
|
|
|
struct usb_extreme_base {
|
|
uint8_t[6 + USBEXTREME_ID_LENGTH + USBEXTREME_NAME_LENGTH] empty;
|
|
uint8_t magic;
|
|
uint8_t[10] empty2;
|
|
}
|
|
|
|
extern(C) int is_oue(immutable(void)* headers, immutable(size_t) headerslen) {
|
|
immutable headers_oeu = cast(immutable usb_extreme_base*) headers;
|
|
immutable headers_nlen = headerslen / USBEXTREME_HEADER_SIZE;
|
|
|
|
for (auto i = 0; i < headers_nlen; i++) {
|
|
immutable header = headers_oeu[i];
|
|
|
|
if (header.magic != USBEXTREME_MAGIC) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
return 1;
|
|
}
|