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

[RFC] Composite USB device #15

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

[RFC] Composite USB device #15

wants to merge 2 commits into from

Conversation

atx
Copy link

@atx atx commented May 30, 2017

This PR removes usb-moded in favor of a single-configuration USB composite device providing ADB, CDC ECM and MTP at once.

Copy link
Member

@FlorentRevest FlorentRevest left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do agree with the main principles of your changes, and ecm works surprisingly well, congratulations and thank you for your work!

However, there are a few things I would want to see changed before allowing your patches to be merged:

  • Some of them are described in code comments attached to this review
  • An error happens in the kernel when trying to start mtp-server. https://gist.github.com/FlorentRevest/f0350240e9d44f10bab7088cef4078ef are you aware of it?
  • Every ~10 seconds USB connection is interrupted, is it a known problem?
  • dev-mtp-usb.device timeouts according to https://gist.github.com/FlorentRevest/b468f9b308b1e449f5440ff1e31b41ed I haven't been able to test MTP.
  • Is connman supposed to be kept installed? If you plan to remove it, have you thought about packages depending on it?
  • DSME keeps track of USB State, could you check whether it's important to its inner working and if we can ignore it or replace the usage of usb-moded to your custom solution.
  • lipstick also relies on usb-moded to show handy notifications when connected or disconnected. Have you thought of a solution to keep lipstick informed of this kind of events?
  • asteroid-settings currently has a "USB page" relying heavily on usb-moded. If we move toward a composite device exposing almost every capabilities at once, I would want to replace the USB page with a Developer Mode page showing the IP address of the watch and maybe also a randomly generated ceres password (just like in SailfishOS). I would also want this Developer Mode to be enabled or disabled at will, allowing to turn adb and ecm off. If the overall state of your solution gets improved I may be able to help you on this task.

Keep up the good work!

+
+target_link_libraries(mtpserver pthread)
+
+target_link_libraries(mtpserver pthread)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You really want this pthread badly, don't you? :)

"

SRC_URI = " \
bzr://code.launchpad.net/~phablet-team/mtp/trunk \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would rather not have asteroid's build system depend on bzr for this single recipe. I couldn't even make it work...

I'd prefer having a mtp-server_0.0.4.bb using:
git://github.com/webOS-ports/mtp-server;protocol=https
and
SRCREV="b5cdb6bbfe3fde97ba65cc270a9b874998a66d07"

DEPENDS += "boost libhybris glog"

do_configure_prepend() {
echo -e "\ntarget_link_libraries(mtpserver pthread)" >> "${S}/CMakeLists.txt"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Considering 0001-Remove-dbus-dependency.patch, I don't think we need to insist much more.

start_usb () {
echo "0" > $ANDROID_USB/enable

log_info "Starting adb mode"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why indicating "adb mode" when you actually activate ffs ecm and mtp?

@@ -0,0 +1,14 @@
[Unit]
Description=mtp-server service
Requires=usb-setup.service dev-mtp_usb.device
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haven't you forgot "After=usb-setup.service" ?

@atx
Copy link
Author

atx commented Jun 3, 2017

An error happens in the kernel when trying to start mtp-server. https://gist.github.com/FlorentRevest/f0350240e9d44f10bab7088cef4078ef are you aware of it?

Yep, happens on lenok too, I didn't notice that. That's probably worthy of debugging.

Every ~10 seconds USB connection is interrupted, is it a known problem?

This is likely caused by a "feature" in libmtp combined with gvfsd automounting the device (and timeouting as you are missing /dev/mtp_usb for some reason). The proper way to fix that is getting a product ID and sending a patch to libmtp. The less-than-proper way is to steal a vid/pid which is handled correctly in libmtp.

dev-mtp-usb.device timeouts...

I am not really sure about why is that the case, dory kernel has f_mtp support so udev should just spawn /dev/mtp_usb after mtp gets activated.

Is connman supposed to be kept installed? If you plan to remove it, have you thought about packages depending on it?

It's not interfering with anything so far. Which packages depend on it? I have a build without it installed (for experimenting with systemd-resolved) and everything seems to work fine (is it enough just as a build dependency?)

DSME keeps track of USB State, could you check whether it's important to its inner working and if we can ignore it or replace the usage of usb-moded to your custom solution.

I am not sure. Looking through the sources, it looks like DSME might end up in an "actdead" state instead of shutting down if it does not know charger state. I don't really know if that is a problem though.

lipstick also relies on usb-moded to show handy notifications when connected or disconnected. Have you thought of a solution to keep lipstick informed of this kind of events?

I completely missed that. I am going to add an udev rule for handling this.

asteroid-settings currently has a "USB page" relying heavily on usb-moded.

I am aware of that. I wanted to get this finalized before starting to patch the interface.

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

Successfully merging this pull request may close these issues.

None yet

2 participants