diff --git a/Cargo.toml b/Cargo.toml index 80b3733..0083a54 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,7 +12,6 @@ repository = "https://github.com/rust-embedded-community/usb-device" [dependencies] defmt = { version = "0.3", optional = true } portable-atomic = { version = "1.2.0", default-features = false } -num_enum = { version = "0.7.1", default-features = false } heapless = "0.8" log = { version = "0.4", default-features = false, optional = true} diff --git a/src/descriptor/lang_id.rs b/src/descriptor/lang_id.rs index 588c99b..1e90a9f 100644 --- a/src/descriptor/lang_id.rs +++ b/src/descriptor/lang_id.rs @@ -1,478 +1,478 @@ #![allow(non_upper_case_globals, non_camel_case_types)] -use num_enum::TryFromPrimitive; +#[allow(missing_docs)] +#[derive(Clone, Copy, PartialEq, Eq, Debug)] +pub struct LangID(u16); -impl From<&LangID> for u16 { - fn from(lang_id: &LangID) -> Self { - *lang_id as u16 +impl From for u16 { + fn from(lang_id: LangID) -> Self { + let LangID(id) = lang_id; + id } } -impl From for u16 { - fn from(lang_id: LangID) -> Self { - lang_id as u16 +impl From for LangID { + fn from(id: u16) -> Self { + LangID(id) } } #[allow(missing_docs)] -#[derive(Clone, Copy, PartialEq, Debug, TryFromPrimitive)] -#[cfg_attr(feature = "defmt", derive(defmt::Format))] -#[repr(u16)] -pub enum LangID { - AR = 0x0001, - BG = 0x0002, - CA = 0x0003, - ZH_HANS = 0x0004, - CS = 0x0005, - DA = 0x0006, - DE = 0x0007, - EL = 0x0008, - EN = 0x0009, - ES = 0x000A, - FI = 0x000B, - FR = 0x000C, - HE = 0x000D, - HU = 0x000E, - IS = 0x000F, - IT = 0x0010, - JA = 0x0011, - KO = 0x0012, - NL = 0x0013, - NO = 0x0014, - PL = 0x0015, - PT = 0x0016, - RM = 0x0017, - RO = 0x0018, - RU = 0x0019, - HR = 0x001A, - SK = 0x001B, - SQ = 0x001C, - SV = 0x001D, - TH = 0x001E, - TR = 0x001F, - UR = 0x0020, - ID = 0x0021, - UK = 0x0022, - BE = 0x0023, - SL = 0x0024, - ET = 0x0025, - LV = 0x0026, - LT = 0x0027, - TG = 0x0028, - FA = 0x0029, - VI = 0x002A, - HY = 0x002B, - AZ = 0x002C, - EU = 0x002D, - HSB = 0x002E, - MK = 0x002F, - ST = 0x0030, - TS = 0x0031, - TN = 0x0032, - VE = 0x0033, - XH = 0x0034, - ZU = 0x0035, - AF = 0x0036, - KA = 0x0037, - FO = 0x0038, - HI = 0x0039, - MT = 0x003A, - SE = 0x003B, - GA = 0x003C, - YI = 0x003D, - MS = 0x003E, - KK = 0x003F, - KY = 0x0040, - SW = 0x0041, - TK = 0x0042, - UZ = 0x0043, - TT = 0x0044, - BN = 0x0045, - PA = 0x0046, - GU = 0x0047, - OR = 0x0048, - TA = 0x0049, - TE = 0x004A, - KN = 0x004B, - ML = 0x004C, - AS = 0x004D, - MR = 0x004E, - SA = 0x004F, - MN = 0x0050, - BO = 0x0051, - CY = 0x0052, - KM = 0x0053, - LO = 0x0054, - MY = 0x0055, - GL = 0x0056, - KOK = 0x0057, - MNI = 0x0058, - SD = 0x0059, - SYR = 0x005A, - SI = 0x005B, - CHR = 0x005C, - IU = 0x005D, - AM = 0x005E, - TZM = 0x005F, - KS = 0x0060, - NE = 0x0061, - FY = 0x0062, - PS = 0x0063, - FIL = 0x0064, - DV = 0x0065, - BIN = 0x0066, - FF = 0x0067, - HA = 0x0068, - IBB = 0x0069, - YO = 0x006A, - QUZ = 0x006B, - NSO = 0x006C, - BA = 0x006D, - LB = 0x006E, - KL = 0x006F, - IG = 0x0070, - KR = 0x0071, - OM = 0x0072, - TI = 0x0073, - GN = 0x0074, - HAW = 0x0075, - LA = 0x0076, - SO = 0x0077, - II = 0x0078, - PAP = 0x0079, - ARN = 0x007A, - MOH = 0x007C, - BR = 0x007E, - UG = 0x0080, - MI = 0x0081, - OC = 0x0082, - CO = 0x0083, - GSW = 0x0084, - SAH = 0x0085, - QUT = 0x0086, - RW = 0x0087, - WO = 0x0088, - PRS = 0x008C, - GD = 0x0091, - KU = 0x0092, - QUC = 0x0093, - AR_SA = 0x0401, - BG_BG = 0x0402, - CA_ES = 0x0403, - ZH_TW = 0x0404, - CS_CZ = 0x0405, - DA_DK = 0x0406, - DE_DE = 0x0407, - EL_GR = 0x0408, - EN_US = 0x0409, - ES_ES_TRADNL = 0x040A, - FI_FI = 0x040B, - FR_FR = 0x040C, - HE_IL = 0x040D, - HU_HU = 0x040E, - IS_IS = 0x040F, - IT_IT = 0x0410, - JA_JP = 0x0411, - KO_KR = 0x0412, - NL_NL = 0x0413, - NB_NO = 0x0414, - PL_PL = 0x0415, - PT_BR = 0x0416, - RM_CH = 0x0417, - RO_RO = 0x0418, - RU_RU = 0x0419, - HR_HR = 0x041A, - SK_SK = 0x041B, - SQ_AL = 0x041C, - SV_SE = 0x041D, - TH_TH = 0x041E, - TR_TR = 0x041F, - UR_PK = 0x0420, - ID_ID = 0x0421, - UK_UA = 0x0422, - BE_BY = 0x0423, - SL_SI = 0x0424, - ET_EE = 0x0425, - LV_LV = 0x0426, - LT_LT = 0x0427, - TG_CYRL_TJ = 0x0428, - FA_IR = 0x0429, - VI_VN = 0x042A, - HY_AM = 0x042B, - AZ_LATN_AZ = 0x042C, - EU_ES = 0x042D, - HSB_DE = 0x042E, - MK_MK = 0x042F, - ST_ZA = 0x0430, - TS_ZA = 0x0431, - TN_ZA = 0x0432, - VE_ZA = 0x0433, - XH_ZA = 0x0434, - ZU_ZA = 0x0435, - AF_ZA = 0x0436, - KA_GE = 0x0437, - FO_FO = 0x0438, - HI_IN = 0x0439, - MT_MT = 0x043A, - SE_NO = 0x043B, - YI_001 = 0x043D, - MS_MY = 0x043E, - KK_KZ = 0x043F, - KY_KG = 0x0440, - SW_KE = 0x0441, - TK_TM = 0x0442, - UZ_LATN_UZ = 0x0443, - TT_RU = 0x0444, - BN_IN = 0x0445, - PA_IN = 0x0446, - GU_IN = 0x0447, - OR_IN = 0x0448, - TA_IN = 0x0449, - TE_IN = 0x044A, - KN_IN = 0x044B, - ML_IN = 0x044C, - AS_IN = 0x044D, - MR_IN = 0x044E, - SA_IN = 0x044F, - MN_MN = 0x0450, - BO_CN = 0x0451, - CY_GB = 0x0452, - KM_KH = 0x0453, - LO_LA = 0x0454, - MY_MM = 0x0455, - GL_ES = 0x0456, - KOK_IN = 0x0457, - MNI_IN = 0x0458, - SD_DEVA_IN = 0x0459, - SYR_SY = 0x045A, - SI_LK = 0x045B, - CHR_CHER_US = 0x045C, - IU_CANS_CA = 0x045D, - AM_ET = 0x045E, - TZM_ARAB_MA = 0x045F, - KS_ARAB = 0x0460, - NE_NP = 0x0461, - FY_NL = 0x0462, - PS_AF = 0x0463, - FIL_PH = 0x0464, - DV_MV = 0x0465, - BIN_NG = 0x0466, - FF_NG__FF_LATN_NG = 0x0467, - HA_LATN_NG = 0x0468, - IBB_NG = 0x0469, - YO_NG = 0x046A, - QUZ_BO = 0x046B, - NSO_ZA = 0x046C, - BA_RU = 0x046D, - LB_LU = 0x046E, - KL_GL = 0x046F, - IG_NG = 0x0470, - KR_LATN_NG = 0x0471, - OM_ET = 0x0472, - TI_ET = 0x0473, - GN_PY = 0x0474, - HAW_US = 0x0475, - LA_VA = 0x0476, - SO_SO = 0x0477, - II_CN = 0x0478, - PAP_029 = 0x0479, - ARN_CL = 0x047A, - MOH_CA = 0x047C, - BR_FR = 0x047E, - UG_CN = 0x0480, - MI_NZ = 0x0481, - OC_FR = 0x0482, - CO_FR = 0x0483, - GSW_FR = 0x0484, - SAH_RU = 0x0485, - QUT_GT = 0x0486, - RW_RW = 0x0487, - WO_SN = 0x0488, - PRS_AF = 0x048C, - PLT_MG = 0x048D, - ZH_YUE_HK = 0x048E, - TDD_TALE_CN = 0x048F, - KHB_TALU_CN = 0x0490, - GD_GB = 0x0491, - KU_ARAB_IQ = 0x0492, - QUC_CO = 0x0493, - QPS_PLOC = 0x0501, - QPS_PLOCA = 0x05FE, - AR_IQ = 0x0801, - CA_ES_VALENCIA = 0x0803, - ZH_CN = 0x0804, - DE_CH = 0x0807, - EN_GB = 0x0809, - ES_MX = 0x080A, - FR_BE = 0x080C, - IT_CH = 0x0810, - JA_PLOC_JP = 0x0811, - NL_BE = 0x0813, - NN_NO = 0x0814, - PT_PT = 0x0816, - RO_MD = 0x0818, - RU_MD = 0x0819, - SR_LATN_CS = 0x081A, - SV_FI = 0x081D, - UR_IN = 0x0820, - AZ_CYRL_AZ = 0x082C, - DSB_DE = 0x082E, - TN_BW = 0x0832, - SE_SE = 0x083B, - GA_IE = 0x083C, - MS_BN = 0x083E, - KK_LATN_KZ = 0x083F, - UZ_CYRL_UZ = 0x0843, - BN_BD = 0x0845, - PA_ARAB_PK = 0x0846, - TA_LK = 0x0849, - MN_MONG_CN = 0x0850, - BO_BT = 0x0851, - SD_ARAB_PK = 0x0859, - IU_LATN_CA = 0x085D, - TZM_LATN_DZ = 0x085F, - KS_DEVA_IN = 0x0860, - NE_IN = 0x0861, - FF_LATN_SN = 0x0867, - QUZ_EC = 0x086B, - TI_ER = 0x0873, - QPS_PLOCM = 0x09FF, - LOCALE_CUSTOM_USER_DEFAULT = 0x0C00, - AR_EG = 0x0C01, - ZH_HK = 0x0C04, - DE_AT = 0x0C07, - EN_AU = 0x0C09, - ES_ES = 0x0C0A, - FR_CA = 0x0C0C, - SR_CYRL_CS = 0x0C1A, - SE_FI = 0x0C3B, - MN_MONG_MN = 0x0C50, - DZ_BT = 0x0C51, - TMZ_MA = 0x0C5F, - QUZ_PE = 0x0C6B, - LOCALE_CUSTOM_UNSPECIFIED = 0x1000, - AR_LY = 0x1001, - ZH_SG = 0x1004, - DE_LU = 0x1007, - EN_CA = 0x1009, - ES_GT = 0x100A, - FR_CH = 0x100C, - HR_BA = 0x101A, - SMJ_NO = 0x103B, - TZM_TFNG_MA = 0x105F, - AR_DZ = 0x1401, - ZH_MO = 0x1404, - DE_LI = 0x1407, - EN_NZ = 0x1409, - ES_CR = 0x140A, - FR_LU = 0x140C, - BS_LATN_BA = 0x141A, - SMJ_SE = 0x143B, - AR_MA = 0x1801, - EN_IE = 0x1809, - ES_PA = 0x180A, - FR_MC = 0x180C, - SR_LATN_BA = 0x181A, - SMA_NO = 0x183B, - AR_TN = 0x1C01, - EN_ZA = 0x1C09, - ES_DO = 0x1C0A, - FR_029 = 0x1C0C, - SR_CYRL_BA = 0x1C1A, - SMA_SE = 0x1C3B, - AR_OM = 0x2001, - EN_JM = 0x2009, - ES_VE = 0x200A, - FR_RE = 0x200C, - BS_CYRL_BA = 0x201A, - SMS_FI = 0x203B, - AR_YE = 0x2401, - EN_029 = 0x2409, - ES_CO = 0x240A, - FR_CD = 0x240C, - SR_LATN_RS = 0x241A, - SMN_FI = 0x243B, - AR_SY = 0x2801, - EN_BZ = 0x2809, - ES_PE = 0x280A, - FR_SN = 0x280C, - SR_CYRL_RS = 0x281A, - AR_JO = 0x2C01, - EN_TT = 0x2C09, - ES_AR = 0x2C0A, - FR_CM = 0x2C0C, - SR_LATN_ME = 0x2C1A, - AR_LB = 0x3001, - EN_ZW = 0x3009, - ES_EC = 0x300A, - FR_CI = 0x300C, - SR_CYRL_ME = 0x301A, - AR_KW = 0x3401, - EN_PH = 0x3409, - ES_CL = 0x340A, - FR_ML = 0x340C, - AR_AE = 0x3801, - EN_ID = 0x3809, - ES_UY = 0x380A, - FR_MA = 0x380C, - AR_BH = 0x3C01, - EN_HK = 0x3C09, - ES_PY = 0x3C0A, - FR_HT = 0x3C0C, - AR_QA = 0x4001, - EN_IN = 0x4009, - ES_BO = 0x400A, - AR_PLOC_SA = 0x4401, - EN_MY = 0x4409, - ES_SV = 0x440A, - AR_145 = 0x4801, - EN_SG = 0x4809, - ES_HN = 0x480A, - EN_AE = 0x4C09, - ES_NI = 0x4C0A, - EN_BH = 0x5009, - ES_PR = 0x500A, - EN_EG = 0x5409, - ES_US = 0x540A, - EN_JO = 0x5809, - ES_419 = 0x580A, - EN_KW = 0x5C09, - ES_CU = 0x5C0A, - EN_TR = 0x6009, - EN_YE = 0x6409, - BS_CYRL = 0x641A, - BS_LATN = 0x681A, - SR_CYRL = 0x6C1A, - SR_LATN = 0x701A, - SMN = 0x703B, - AZ_CYRL = 0x742C, - SMS = 0x743B, - ZH = 0x7804, - NN = 0x7814, - BS = 0x781A, - AZ_LATN = 0x782C, - SMA = 0x783B, - KK_CYRL = 0x783F, - UZ_CYRL = 0x7843, - MN_CYRL = 0x7850, - IU_CANS = 0x785D, - TZM_TFNG = 0x785F, - ZH_HANT = 0x7C04, - NB = 0x7C14, - SR = 0x7C1A, - TG_CYRL = 0x7C28, - DSB = 0x7C2E, - SMJ = 0x7C3B, - KK_LATN = 0x7C3F, - UZ_LATN = 0x7C43, - PA_ARAB = 0x7C46, - MN_MONG = 0x7C50, - SD_ARAB = 0x7C59, - CHR_CHER = 0x7C5C, - IU_LATN = 0x7C5D, - TZM_LATN = 0x7C5F, - FF_LATN = 0x7C67, - HA_LATN = 0x7C68, - KU_ARAB = 0x7C92, - FR_015 = 0xE40C, +impl LangID { + pub const AR: LangID = LangID(0x0001); + pub const BG: LangID = LangID(0x0002); + pub const CA: LangID = LangID(0x0003); + pub const ZH_HANS: LangID = LangID(0x0004); + pub const CS: LangID = LangID(0x0005); + pub const DA: LangID = LangID(0x0006); + pub const DE: LangID = LangID(0x0007); + pub const EL: LangID = LangID(0x0008); + pub const EN: LangID = LangID(0x0009); + pub const ES: LangID = LangID(0x000A); + pub const FI: LangID = LangID(0x000B); + pub const FR: LangID = LangID(0x000C); + pub const HE: LangID = LangID(0x000D); + pub const HU: LangID = LangID(0x000E); + pub const IS: LangID = LangID(0x000F); + pub const IT: LangID = LangID(0x0010); + pub const JA: LangID = LangID(0x0011); + pub const KO: LangID = LangID(0x0012); + pub const NL: LangID = LangID(0x0013); + pub const NO: LangID = LangID(0x0014); + pub const PL: LangID = LangID(0x0015); + pub const PT: LangID = LangID(0x0016); + pub const RM: LangID = LangID(0x0017); + pub const RO: LangID = LangID(0x0018); + pub const RU: LangID = LangID(0x0019); + pub const HR: LangID = LangID(0x001A); + pub const SK: LangID = LangID(0x001B); + pub const SQ: LangID = LangID(0x001C); + pub const SV: LangID = LangID(0x001D); + pub const TH: LangID = LangID(0x001E); + pub const TR: LangID = LangID(0x001F); + pub const UR: LangID = LangID(0x0020); + pub const ID: LangID = LangID(0x0021); + pub const UK: LangID = LangID(0x0022); + pub const BE: LangID = LangID(0x0023); + pub const SL: LangID = LangID(0x0024); + pub const ET: LangID = LangID(0x0025); + pub const LV: LangID = LangID(0x0026); + pub const LT: LangID = LangID(0x0027); + pub const TG: LangID = LangID(0x0028); + pub const FA: LangID = LangID(0x0029); + pub const VI: LangID = LangID(0x002A); + pub const HY: LangID = LangID(0x002B); + pub const AZ: LangID = LangID(0x002C); + pub const EU: LangID = LangID(0x002D); + pub const HSB: LangID = LangID(0x002E); + pub const MK: LangID = LangID(0x002F); + pub const ST: LangID = LangID(0x0030); + pub const TS: LangID = LangID(0x0031); + pub const TN: LangID = LangID(0x0032); + pub const VE: LangID = LangID(0x0033); + pub const XH: LangID = LangID(0x0034); + pub const ZU: LangID = LangID(0x0035); + pub const AF: LangID = LangID(0x0036); + pub const KA: LangID = LangID(0x0037); + pub const FO: LangID = LangID(0x0038); + pub const HI: LangID = LangID(0x0039); + pub const MT: LangID = LangID(0x003A); + pub const SE: LangID = LangID(0x003B); + pub const GA: LangID = LangID(0x003C); + pub const YI: LangID = LangID(0x003D); + pub const MS: LangID = LangID(0x003E); + pub const KK: LangID = LangID(0x003F); + pub const KY: LangID = LangID(0x0040); + pub const SW: LangID = LangID(0x0041); + pub const TK: LangID = LangID(0x0042); + pub const UZ: LangID = LangID(0x0043); + pub const TT: LangID = LangID(0x0044); + pub const BN: LangID = LangID(0x0045); + pub const PA: LangID = LangID(0x0046); + pub const GU: LangID = LangID(0x0047); + pub const OR: LangID = LangID(0x0048); + pub const TA: LangID = LangID(0x0049); + pub const TE: LangID = LangID(0x004A); + pub const KN: LangID = LangID(0x004B); + pub const ML: LangID = LangID(0x004C); + pub const AS: LangID = LangID(0x004D); + pub const MR: LangID = LangID(0x004E); + pub const SA: LangID = LangID(0x004F); + pub const MN: LangID = LangID(0x0050); + pub const BO: LangID = LangID(0x0051); + pub const CY: LangID = LangID(0x0052); + pub const KM: LangID = LangID(0x0053); + pub const LO: LangID = LangID(0x0054); + pub const MY: LangID = LangID(0x0055); + pub const GL: LangID = LangID(0x0056); + pub const KOK: LangID = LangID(0x0057); + pub const MNI: LangID = LangID(0x0058); + pub const SD: LangID = LangID(0x0059); + pub const SYR: LangID = LangID(0x005A); + pub const SI: LangID = LangID(0x005B); + pub const CHR: LangID = LangID(0x005C); + pub const IU: LangID = LangID(0x005D); + pub const AM: LangID = LangID(0x005E); + pub const TZM: LangID = LangID(0x005F); + pub const KS: LangID = LangID(0x0060); + pub const NE: LangID = LangID(0x0061); + pub const FY: LangID = LangID(0x0062); + pub const PS: LangID = LangID(0x0063); + pub const FIL: LangID = LangID(0x0064); + pub const DV: LangID = LangID(0x0065); + pub const BIN: LangID = LangID(0x0066); + pub const FF: LangID = LangID(0x0067); + pub const HA: LangID = LangID(0x0068); + pub const IBB: LangID = LangID(0x0069); + pub const YO: LangID = LangID(0x006A); + pub const QUZ: LangID = LangID(0x006B); + pub const NSO: LangID = LangID(0x006C); + pub const BA: LangID = LangID(0x006D); + pub const LB: LangID = LangID(0x006E); + pub const KL: LangID = LangID(0x006F); + pub const IG: LangID = LangID(0x0070); + pub const KR: LangID = LangID(0x0071); + pub const OM: LangID = LangID(0x0072); + pub const TI: LangID = LangID(0x0073); + pub const GN: LangID = LangID(0x0074); + pub const HAW: LangID = LangID(0x0075); + pub const LA: LangID = LangID(0x0076); + pub const SO: LangID = LangID(0x0077); + pub const II: LangID = LangID(0x0078); + pub const PAP: LangID = LangID(0x0079); + pub const ARN: LangID = LangID(0x007A); + pub const MOH: LangID = LangID(0x007C); + pub const BR: LangID = LangID(0x007E); + pub const UG: LangID = LangID(0x0080); + pub const MI: LangID = LangID(0x0081); + pub const OC: LangID = LangID(0x0082); + pub const CO: LangID = LangID(0x0083); + pub const GSW: LangID = LangID(0x0084); + pub const SAH: LangID = LangID(0x0085); + pub const QUT: LangID = LangID(0x0086); + pub const RW: LangID = LangID(0x0087); + pub const WO: LangID = LangID(0x0088); + pub const PRS: LangID = LangID(0x008C); + pub const GD: LangID = LangID(0x0091); + pub const KU: LangID = LangID(0x0092); + pub const QUC: LangID = LangID(0x0093); + pub const AR_SA: LangID = LangID(0x0401); + pub const BG_BG: LangID = LangID(0x0402); + pub const CA_ES: LangID = LangID(0x0403); + pub const ZH_TW: LangID = LangID(0x0404); + pub const CS_CZ: LangID = LangID(0x0405); + pub const DA_DK: LangID = LangID(0x0406); + pub const DE_DE: LangID = LangID(0x0407); + pub const EL_GR: LangID = LangID(0x0408); + pub const EN_US: LangID = LangID(0x0409); + pub const ES_ES_TRADNL: LangID = LangID(0x040A); + pub const FI_FI: LangID = LangID(0x040B); + pub const FR_FR: LangID = LangID(0x040C); + pub const HE_IL: LangID = LangID(0x040D); + pub const HU_HU: LangID = LangID(0x040E); + pub const IS_IS: LangID = LangID(0x040F); + pub const IT_IT: LangID = LangID(0x0410); + pub const JA_JP: LangID = LangID(0x0411); + pub const KO_KR: LangID = LangID(0x0412); + pub const NL_NL: LangID = LangID(0x0413); + pub const NB_NO: LangID = LangID(0x0414); + pub const PL_PL: LangID = LangID(0x0415); + pub const PT_BR: LangID = LangID(0x0416); + pub const RM_CH: LangID = LangID(0x0417); + pub const RO_RO: LangID = LangID(0x0418); + pub const RU_RU: LangID = LangID(0x0419); + pub const HR_HR: LangID = LangID(0x041A); + pub const SK_SK: LangID = LangID(0x041B); + pub const SQ_AL: LangID = LangID(0x041C); + pub const SV_SE: LangID = LangID(0x041D); + pub const TH_TH: LangID = LangID(0x041E); + pub const TR_TR: LangID = LangID(0x041F); + pub const UR_PK: LangID = LangID(0x0420); + pub const ID_ID: LangID = LangID(0x0421); + pub const UK_UA: LangID = LangID(0x0422); + pub const BE_BY: LangID = LangID(0x0423); + pub const SL_SI: LangID = LangID(0x0424); + pub const ET_EE: LangID = LangID(0x0425); + pub const LV_LV: LangID = LangID(0x0426); + pub const LT_LT: LangID = LangID(0x0427); + pub const TG_CYRL_TJ: LangID = LangID(0x0428); + pub const FA_IR: LangID = LangID(0x0429); + pub const VI_VN: LangID = LangID(0x042A); + pub const HY_AM: LangID = LangID(0x042B); + pub const AZ_LATN_AZ: LangID = LangID(0x042C); + pub const EU_ES: LangID = LangID(0x042D); + pub const HSB_DE: LangID = LangID(0x042E); + pub const MK_MK: LangID = LangID(0x042F); + pub const ST_ZA: LangID = LangID(0x0430); + pub const TS_ZA: LangID = LangID(0x0431); + pub const TN_ZA: LangID = LangID(0x0432); + pub const VE_ZA: LangID = LangID(0x0433); + pub const XH_ZA: LangID = LangID(0x0434); + pub const ZU_ZA: LangID = LangID(0x0435); + pub const AF_ZA: LangID = LangID(0x0436); + pub const KA_GE: LangID = LangID(0x0437); + pub const FO_FO: LangID = LangID(0x0438); + pub const HI_IN: LangID = LangID(0x0439); + pub const MT_MT: LangID = LangID(0x043A); + pub const SE_NO: LangID = LangID(0x043B); + pub const YI_001: LangID = LangID(0x043D); + pub const MS_MY: LangID = LangID(0x043E); + pub const KK_KZ: LangID = LangID(0x043F); + pub const KY_KG: LangID = LangID(0x0440); + pub const SW_KE: LangID = LangID(0x0441); + pub const TK_TM: LangID = LangID(0x0442); + pub const UZ_LATN_UZ: LangID = LangID(0x0443); + pub const TT_RU: LangID = LangID(0x0444); + pub const BN_IN: LangID = LangID(0x0445); + pub const PA_IN: LangID = LangID(0x0446); + pub const GU_IN: LangID = LangID(0x0447); + pub const OR_IN: LangID = LangID(0x0448); + pub const TA_IN: LangID = LangID(0x0449); + pub const TE_IN: LangID = LangID(0x044A); + pub const KN_IN: LangID = LangID(0x044B); + pub const ML_IN: LangID = LangID(0x044C); + pub const AS_IN: LangID = LangID(0x044D); + pub const MR_IN: LangID = LangID(0x044E); + pub const SA_IN: LangID = LangID(0x044F); + pub const MN_MN: LangID = LangID(0x0450); + pub const BO_CN: LangID = LangID(0x0451); + pub const CY_GB: LangID = LangID(0x0452); + pub const KM_KH: LangID = LangID(0x0453); + pub const LO_LA: LangID = LangID(0x0454); + pub const MY_MM: LangID = LangID(0x0455); + pub const GL_ES: LangID = LangID(0x0456); + pub const KOK_IN: LangID = LangID(0x0457); + pub const MNI_IN: LangID = LangID(0x0458); + pub const SD_DEVA_IN: LangID = LangID(0x0459); + pub const SYR_SY: LangID = LangID(0x045A); + pub const SI_LK: LangID = LangID(0x045B); + pub const CHR_CHER_US: LangID = LangID(0x045C); + pub const IU_CANS_CA: LangID = LangID(0x045D); + pub const AM_ET: LangID = LangID(0x045E); + pub const TZM_ARAB_MA: LangID = LangID(0x045F); + pub const KS_ARAB: LangID = LangID(0x0460); + pub const NE_NP: LangID = LangID(0x0461); + pub const FY_NL: LangID = LangID(0x0462); + pub const PS_AF: LangID = LangID(0x0463); + pub const FIL_PH: LangID = LangID(0x0464); + pub const DV_MV: LangID = LangID(0x0465); + pub const BIN_NG: LangID = LangID(0x0466); + pub const FF_NG__FF_LATN_NG: LangID = LangID(0x0467); + pub const HA_LATN_NG: LangID = LangID(0x0468); + pub const IBB_NG: LangID = LangID(0x0469); + pub const YO_NG: LangID = LangID(0x046A); + pub const QUZ_BO: LangID = LangID(0x046B); + pub const NSO_ZA: LangID = LangID(0x046C); + pub const BA_RU: LangID = LangID(0x046D); + pub const LB_LU: LangID = LangID(0x046E); + pub const KL_GL: LangID = LangID(0x046F); + pub const IG_NG: LangID = LangID(0x0470); + pub const KR_LATN_NG: LangID = LangID(0x0471); + pub const OM_ET: LangID = LangID(0x0472); + pub const TI_ET: LangID = LangID(0x0473); + pub const GN_PY: LangID = LangID(0x0474); + pub const HAW_US: LangID = LangID(0x0475); + pub const LA_VA: LangID = LangID(0x0476); + pub const SO_SO: LangID = LangID(0x0477); + pub const II_CN: LangID = LangID(0x0478); + pub const PAP_029: LangID = LangID(0x0479); + pub const ARN_CL: LangID = LangID(0x047A); + pub const MOH_CA: LangID = LangID(0x047C); + pub const BR_FR: LangID = LangID(0x047E); + pub const UG_CN: LangID = LangID(0x0480); + pub const MI_NZ: LangID = LangID(0x0481); + pub const OC_FR: LangID = LangID(0x0482); + pub const CO_FR: LangID = LangID(0x0483); + pub const GSW_FR: LangID = LangID(0x0484); + pub const SAH_RU: LangID = LangID(0x0485); + pub const QUT_GT: LangID = LangID(0x0486); + pub const RW_RW: LangID = LangID(0x0487); + pub const WO_SN: LangID = LangID(0x0488); + pub const PRS_AF: LangID = LangID(0x048C); + pub const PLT_MG: LangID = LangID(0x048D); + pub const ZH_YUE_HK: LangID = LangID(0x048E); + pub const TDD_TALE_CN: LangID = LangID(0x048F); + pub const KHB_TALU_CN: LangID = LangID(0x0490); + pub const GD_GB: LangID = LangID(0x0491); + pub const KU_ARAB_IQ: LangID = LangID(0x0492); + pub const QUC_CO: LangID = LangID(0x0493); + pub const QPS_PLOC: LangID = LangID(0x0501); + pub const QPS_PLOCA: LangID = LangID(0x05FE); + pub const AR_IQ: LangID = LangID(0x0801); + pub const CA_ES_VALENCIA: LangID = LangID(0x0803); + pub const ZH_CN: LangID = LangID(0x0804); + pub const DE_CH: LangID = LangID(0x0807); + pub const EN_GB: LangID = LangID(0x0809); + pub const ES_MX: LangID = LangID(0x080A); + pub const FR_BE: LangID = LangID(0x080C); + pub const IT_CH: LangID = LangID(0x0810); + pub const JA_PLOC_JP: LangID = LangID(0x0811); + pub const NL_BE: LangID = LangID(0x0813); + pub const NN_NO: LangID = LangID(0x0814); + pub const PT_PT: LangID = LangID(0x0816); + pub const RO_MD: LangID = LangID(0x0818); + pub const RU_MD: LangID = LangID(0x0819); + pub const SR_LATN_CS: LangID = LangID(0x081A); + pub const SV_FI: LangID = LangID(0x081D); + pub const UR_IN: LangID = LangID(0x0820); + pub const AZ_CYRL_AZ: LangID = LangID(0x082C); + pub const DSB_DE: LangID = LangID(0x082E); + pub const TN_BW: LangID = LangID(0x0832); + pub const SE_SE: LangID = LangID(0x083B); + pub const GA_IE: LangID = LangID(0x083C); + pub const MS_BN: LangID = LangID(0x083E); + pub const KK_LATN_KZ: LangID = LangID(0x083F); + pub const UZ_CYRL_UZ: LangID = LangID(0x0843); + pub const BN_BD: LangID = LangID(0x0845); + pub const PA_ARAB_PK: LangID = LangID(0x0846); + pub const TA_LK: LangID = LangID(0x0849); + pub const MN_MONG_CN: LangID = LangID(0x0850); + pub const BO_BT: LangID = LangID(0x0851); + pub const SD_ARAB_PK: LangID = LangID(0x0859); + pub const IU_LATN_CA: LangID = LangID(0x085D); + pub const TZM_LATN_DZ: LangID = LangID(0x085F); + pub const KS_DEVA_IN: LangID = LangID(0x0860); + pub const NE_IN: LangID = LangID(0x0861); + pub const FF_LATN_SN: LangID = LangID(0x0867); + pub const QUZ_EC: LangID = LangID(0x086B); + pub const TI_ER: LangID = LangID(0x0873); + pub const QPS_PLOCM: LangID = LangID(0x09FF); + pub const LOCALE_CUSTOM_USER_DEFAULT: LangID = LangID(0x0C00); + pub const AR_EG: LangID = LangID(0x0C01); + pub const ZH_HK: LangID = LangID(0x0C04); + pub const DE_AT: LangID = LangID(0x0C07); + pub const EN_AU: LangID = LangID(0x0C09); + pub const ES_ES: LangID = LangID(0x0C0A); + pub const FR_CA: LangID = LangID(0x0C0C); + pub const SR_CYRL_CS: LangID = LangID(0x0C1A); + pub const SE_FI: LangID = LangID(0x0C3B); + pub const MN_MONG_MN: LangID = LangID(0x0C50); + pub const DZ_BT: LangID = LangID(0x0C51); + pub const TMZ_MA: LangID = LangID(0x0C5F); + pub const QUZ_PE: LangID = LangID(0x0C6B); + pub const LOCALE_CUSTOM_UNSPECIFIED: LangID = LangID(0x1000); + pub const AR_LY: LangID = LangID(0x1001); + pub const ZH_SG: LangID = LangID(0x1004); + pub const DE_LU: LangID = LangID(0x1007); + pub const EN_CA: LangID = LangID(0x1009); + pub const ES_GT: LangID = LangID(0x100A); + pub const FR_CH: LangID = LangID(0x100C); + pub const HR_BA: LangID = LangID(0x101A); + pub const SMJ_NO: LangID = LangID(0x103B); + pub const TZM_TFNG_MA: LangID = LangID(0x105F); + pub const AR_DZ: LangID = LangID(0x1401); + pub const ZH_MO: LangID = LangID(0x1404); + pub const DE_LI: LangID = LangID(0x1407); + pub const EN_NZ: LangID = LangID(0x1409); + pub const ES_CR: LangID = LangID(0x140A); + pub const FR_LU: LangID = LangID(0x140C); + pub const BS_LATN_BA: LangID = LangID(0x141A); + pub const SMJ_SE: LangID = LangID(0x143B); + pub const AR_MA: LangID = LangID(0x1801); + pub const EN_IE: LangID = LangID(0x1809); + pub const ES_PA: LangID = LangID(0x180A); + pub const FR_MC: LangID = LangID(0x180C); + pub const SR_LATN_BA: LangID = LangID(0x181A); + pub const SMA_NO: LangID = LangID(0x183B); + pub const AR_TN: LangID = LangID(0x1C01); + pub const EN_ZA: LangID = LangID(0x1C09); + pub const ES_DO: LangID = LangID(0x1C0A); + pub const FR_029: LangID = LangID(0x1C0C); + pub const SR_CYRL_BA: LangID = LangID(0x1C1A); + pub const SMA_SE: LangID = LangID(0x1C3B); + pub const AR_OM: LangID = LangID(0x2001); + pub const EN_JM: LangID = LangID(0x2009); + pub const ES_VE: LangID = LangID(0x200A); + pub const FR_RE: LangID = LangID(0x200C); + pub const BS_CYRL_BA: LangID = LangID(0x201A); + pub const SMS_FI: LangID = LangID(0x203B); + pub const AR_YE: LangID = LangID(0x2401); + pub const EN_029: LangID = LangID(0x2409); + pub const ES_CO: LangID = LangID(0x240A); + pub const FR_CD: LangID = LangID(0x240C); + pub const SR_LATN_RS: LangID = LangID(0x241A); + pub const SMN_FI: LangID = LangID(0x243B); + pub const AR_SY: LangID = LangID(0x2801); + pub const EN_BZ: LangID = LangID(0x2809); + pub const ES_PE: LangID = LangID(0x280A); + pub const FR_SN: LangID = LangID(0x280C); + pub const SR_CYRL_RS: LangID = LangID(0x281A); + pub const AR_JO: LangID = LangID(0x2C01); + pub const EN_TT: LangID = LangID(0x2C09); + pub const ES_AR: LangID = LangID(0x2C0A); + pub const FR_CM: LangID = LangID(0x2C0C); + pub const SR_LATN_ME: LangID = LangID(0x2C1A); + pub const AR_LB: LangID = LangID(0x3001); + pub const EN_ZW: LangID = LangID(0x3009); + pub const ES_EC: LangID = LangID(0x300A); + pub const FR_CI: LangID = LangID(0x300C); + pub const SR_CYRL_ME: LangID = LangID(0x301A); + pub const AR_KW: LangID = LangID(0x3401); + pub const EN_PH: LangID = LangID(0x3409); + pub const ES_CL: LangID = LangID(0x340A); + pub const FR_ML: LangID = LangID(0x340C); + pub const AR_AE: LangID = LangID(0x3801); + pub const EN_ID: LangID = LangID(0x3809); + pub const ES_UY: LangID = LangID(0x380A); + pub const FR_MA: LangID = LangID(0x380C); + pub const AR_BH: LangID = LangID(0x3C01); + pub const EN_HK: LangID = LangID(0x3C09); + pub const ES_PY: LangID = LangID(0x3C0A); + pub const FR_HT: LangID = LangID(0x3C0C); + pub const AR_QA: LangID = LangID(0x4001); + pub const EN_IN: LangID = LangID(0x4009); + pub const ES_BO: LangID = LangID(0x400A); + pub const AR_PLOC_SA: LangID = LangID(0x4401); + pub const EN_MY: LangID = LangID(0x4409); + pub const ES_SV: LangID = LangID(0x440A); + pub const AR_145: LangID = LangID(0x4801); + pub const EN_SG: LangID = LangID(0x4809); + pub const ES_HN: LangID = LangID(0x480A); + pub const EN_AE: LangID = LangID(0x4C09); + pub const ES_NI: LangID = LangID(0x4C0A); + pub const EN_BH: LangID = LangID(0x5009); + pub const ES_PR: LangID = LangID(0x500A); + pub const EN_EG: LangID = LangID(0x5409); + pub const ES_US: LangID = LangID(0x540A); + pub const EN_JO: LangID = LangID(0x5809); + pub const ES_419: LangID = LangID(0x580A); + pub const EN_KW: LangID = LangID(0x5C09); + pub const ES_CU: LangID = LangID(0x5C0A); + pub const EN_TR: LangID = LangID(0x6009); + pub const EN_YE: LangID = LangID(0x6409); + pub const BS_CYRL: LangID = LangID(0x641A); + pub const BS_LATN: LangID = LangID(0x681A); + pub const SR_CYRL: LangID = LangID(0x6C1A); + pub const SR_LATN: LangID = LangID(0x701A); + pub const SMN: LangID = LangID(0x703B); + pub const AZ_CYRL: LangID = LangID(0x742C); + pub const SMS: LangID = LangID(0x743B); + pub const ZH: LangID = LangID(0x7804); + pub const NN: LangID = LangID(0x7814); + pub const BS: LangID = LangID(0x781A); + pub const AZ_LATN: LangID = LangID(0x782C); + pub const SMA: LangID = LangID(0x783B); + pub const KK_CYRL: LangID = LangID(0x783F); + pub const UZ_CYRL: LangID = LangID(0x7843); + pub const MN_CYRL: LangID = LangID(0x7850); + pub const IU_CANS: LangID = LangID(0x785D); + pub const TZM_TFNG: LangID = LangID(0x785F); + pub const ZH_HANT: LangID = LangID(0x7C04); + pub const NB: LangID = LangID(0x7C14); + pub const SR: LangID = LangID(0x7C1A); + pub const TG_CYRL: LangID = LangID(0x7C28); + pub const DSB: LangID = LangID(0x7C2E); + pub const SMJ: LangID = LangID(0x7C3B); + pub const KK_LATN: LangID = LangID(0x7C3F); + pub const UZ_LATN: LangID = LangID(0x7C43); + pub const PA_ARAB: LangID = LangID(0x7C46); + pub const MN_MONG: LangID = LangID(0x7C50); + pub const SD_ARAB: LangID = LangID(0x7C59); + pub const CHR_CHER: LangID = LangID(0x7C5C); + pub const IU_LATN: LangID = LangID(0x7C5D); + pub const TZM_LATN: LangID = LangID(0x7C5F); + pub const FF_LATN: LangID = LangID(0x7C67); + pub const HA_LATN: LangID = LangID(0x7C68); + pub const KU_ARAB: LangID = LangID(0x7C92); + pub const FR_015: LangID = LangID(0xE40C); } diff --git a/src/device.rs b/src/device.rs index 2bd8555..a2f24f9 100644 --- a/src/device.rs +++ b/src/device.rs @@ -6,7 +6,6 @@ use crate::descriptor::{descriptor_type, lang_id::LangID, BosWriter, DescriptorW pub use crate::device_builder::{StringDescriptors, UsbDeviceBuilder, UsbVidPid}; use crate::endpoint::{EndpointAddress, EndpointType}; use crate::{Result, UsbDirection}; -use core::convert::TryFrom; /// The global state of the USB device. /// @@ -593,18 +592,8 @@ impl UsbDevice<'_, B> { // rest STRING Requests _ => { - let lang_id = match LangID::try_from(req.index) { - Err(_err) => { - #[cfg(feature = "defmt")] - defmt::warn!( - "Receive unknown LANGID {:#06X}, default to EN_US", - _err.number - ); - LangID::EN_US - } + let lang_id = LangID::from(req.index); - Ok(req_lang_id) => req_lang_id, - }; let string = match index { // Manufacturer, product, and serial are handled directly here. 1..=3 => {