Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libusbgx uses 0x409 for language instead of 0x0409 #45

Open
buzmeg opened this issue Jan 9, 2020 · 4 comments
Open

libusbgx uses 0x409 for language instead of 0x0409 #45

buzmeg opened this issue Jan 9, 2020 · 4 comments

Comments

@buzmeg
Copy link

buzmeg commented Jan 9, 2020

This caused me no end of grief today. I was kept getting USBG_ERROR_NOT_FOUND on my language directories. It turns out that libusbg regards 0x409 and 0x0409 as different.

It should probably deal with both, but I'm pretty sure that 0x0409 is canonical with the standard, so libusbgx probably needs to accept and emit that.

Thanks.

# git diff usbg.c 
diff --git a/src/usbg.c b/src/usbg.c
index d2bf381..86f9820 100644
--- a/src/usbg.c
+++ b/src/usbg.c
@@ -540,7 +540,7 @@ static int usbg_parse_config_strs(const char *path, const char *name,
        int nmb;
        char spath[USBG_MAX_PATH_LENGTH];
 
-       nmb = snprintf(spath, sizeof(spath), "%s/%s/%s/0x%x", path, name,
+       nmb = snprintf(spath, sizeof(spath), "%s/%s/%s/0x%04x", path, name,
                        STRINGS_DIR, lang);
        if (nmb >= sizeof(spath)) {
                ret = USBG_ERROR_PATH_TOO_LONG;
@@ -856,7 +856,7 @@ static int usbg_parse_gadget_strs(const char *path, const char *name, int lang,
        DIR *dir;
        char spath[USBG_MAX_PATH_LENGTH];
 
-       nmb = snprintf(spath, sizeof(spath), "%s/%s/%s/0x%x", path, name,
+       nmb = snprintf(spath, sizeof(spath), "%s/%s/%s/0x%04x", path, name,
                        STRINGS_DIR, lang);
        if (nmb >= sizeof(spath)) {
                ret = USBG_ERROR_PATH_TOO_LONG;

@kopasiak
Copy link
Collaborator

Hmmm... What is the kernel reaction if you try to provide both 0x0409 and 0x409?

@pabs3
Copy link
Member

pabs3 commented Jul 13, 2021

@buzmeg can you check the question that was asked here? Also can you resubmit this patch as a pull request instead, so you can be credited in the commit log?

@buzmeg
Copy link
Author

buzmeg commented Jul 20, 2021

It's been a while since I have even touched anything USB. I eventually just decided that I was banging into too many obscure corners of the USB Gadget system and that libusbgx was not really going to be able to help. Consequently, I haven't looked at this in forever.

Sorry.

@buzmeg
Copy link
Author

buzmeg commented Nov 20, 2023

Old bug that I no longer can help track. Closing.

@buzmeg buzmeg closed this as not planned Won't fix, can't repro, duplicate, stale Nov 20, 2023
@pabs3 pabs3 reopened this Nov 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants