ks: Add support for libusb communication#100
Conversation
Signed-off-by: Marek Mojík <marek.mojik@nic.cz>
|
cc @quic-jhugo |
|
(commenting before I actually have a look at the code) |
| @@ -62,6 +52,7 @@ int main(int argc, char **argv) | |||
| {"version", no_argument, 0, 'v'}, | |||
| {"port", required_argument, 0, 'p'}, | |||
There was a problem hiding this comment.
This is still listed as required, but the documentation changes above suggest that this PR is making it optional
There was a problem hiding this comment.
Thats the has_args field, which states that the flag requires argument not that the flag itself is required
| { | ||
|
|
||
| return write(qdl->fd, buf, len); | ||
| } |
There was a problem hiding this comment.
How does removing these definitions not cause a compile error?
There was a problem hiding this comment.
These functions are defined in qdl.h and already implemented in usb.c, I edited the usb.c implementation so that if the fd field in qdl struct is defined the file descriptor is used instead of libusb. This solution is not ideal, but its the best I could come up with without more extensive changes to the codebase, which seem pointless as only ks uses file descriptors.
| int ret; | ||
|
|
||
| if (qdl->fd != 0) | ||
| return read(qdl->fd, buf, len); |
There was a problem hiding this comment.
I think defining a separate simple chardev backend would make more sense.. this works, but is not pretty
|
The commit subject for the proposed patch seems more to "ks: replace chardev support with libusb", but the commit message lacks the necessary details to understand what problem you're actually solving and in which situation this is the right thing to do. Also, the commit message should describe why it's the right thing to "replace" instead of "add". |
This patch adds support for libusb communication with devices in edl mode, while retaining the existing implementation using file descriptors. It's unclear to me if the file descriptor implementation is actively used by anyone (it doesn't work very well for me), so feedback on its usage and potential deletion is welcome.