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

How to link configuration to os_descs? #31

Open
mrschyte opened this issue Oct 23, 2023 · 6 comments
Open

How to link configuration to os_descs? #31

mrschyte opened this issue Oct 23, 2023 · 6 comments

Comments

@mrschyte
Copy link

Is there a way to link a configuration to os_desc?

Normally I'd issue ln -s configs/c.1/ os_desc in the gadget configfs folder, but I'd like to do this with a gadget-tool schema if possible.

I've tried specifying the os_descs multiple ways, but gt never seems to link the config.

@pabs3
Copy link
Member

pabs3 commented Oct 24, 2023

I don't think I understand the code fully, but from a quick glance; in libusbgx, symlink() from libc is called with os_desc, from usbg_create_os_desc_link(), from usbg_set_os_desc_config(), from usbg_import_gadget_os_descs(), from usbg_import_gadget_run(), from usbg_import_gadget(), from load_func() in gt. So in theory this symlink should be happening already if the config has the right string. So there could be a bug, or the config might be incorrect. I note there is an example in the example systemd README.md, if something like that doesn't work then it is likely a bug that someone will need to figure out.

@mrschyte
Copy link
Author

Thanks for looking into this. Unfortunately, I've already tried with the linked example to no avail. The descriptors do get set, however the symlink is missing, so they're not applied to the configuration. Currently I'm just running ln manually after gt load. I'll try running strace/ltrace to see if symlink is called at all.

@pabs3
Copy link
Member

pabs3 commented Oct 25, 2023 via email

@mrschyte
Copy link
Author

I couldn't get ltrace working (I'm running this on a Raspberry Pi and it's throwing an error for some reason). I did verify using gdb that symlink is not called for linking the config under os_descs. I'll try setting up dummy-hcd.

@mrschyte
Copy link
Author

Please find the traces and the gadget scheme file here: https://gist.github.com/mrschyte/d9de2ff6ad95157ff43bc55fec618621

@pabs3
Copy link
Member

pabs3 commented Oct 29, 2023 via email

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

2 participants