Friday, 2018-08-31

eduardas_mspiiroin: hello, I would like to make buteo-mtp a standalone component that I could use in my Yocto builds without any other mer middleware... could you provide advice on the best way to go about this?09:24
eduardas_mi.e. what are the parts of the code that can be safely removed or need to be changed?09:25
r0kk3rzeduardas_m: im not sure that makes sense10:02
eduardas_mr0kk3rz: well, I need a USB-MTP solution for a Yocto project based system and something that is not under GPLv3/LGPLv3 is needed (permissive licenses are preferred, of course)10:13
eduardas_mand I do not want to pull in all of the mer middleware just to have USB-MTP10:14
eduardas_mr0kk3rz: and there aren't that many USB-MTP solutions for Linux:
r0kk3rzyeah i can see that, most of them deal with the host side not the gadget side10:15
eduardas_muMTP-Responder is under GPLv3 and Ubuntu Touch MTP server too10:15
r0kk3rzit shouldnt be too bad if you pull in syncd10:15
eduardas_mr0kk3rz: what is that? where is it located in the source? what does it do?10:16
r0kk3rzbut the whole thing is written in qt, so you'll need that too10:16
eduardas_mr0kk3rz: I already have Qt, so no problem there10:16
r0kk3rzsorry, better look at the proper one -
eduardas_mr0kk3rz: thank you, but what does it do exactly?10:19
r0kk3rzok, so that mtp thing, is a plugin for msyncd10:20
eduardas_mr0kk3rz: also my problem now is that I can not find the place where it is specified for buteo-mtp what part of the flash storage to expose10:20
r0kk3rzeduardas_m: thats because its complicated :)10:24
eduardas_mr0kk3rz: that is a simple fact of life in embedded Linux...everything is complicated...10:26
r0kk3rzwell iirc, the way that part works is probably not the way you want10:27
eduardas_mr0kk3rz: also what is contextkit?... I see it is a dependency of buteo-mtp10:27
eduardas_mI just want to set a single partition with user files and be done with it, honestly10:28
eduardas_muMTP-Responder has a config for that and in Ubuntu Touch it is enough to hardcode a single string10:29
eduardas_mr0kk3rz: not sure, but perhaps fsstorageplugin is responsible for that:
r0kk3rzeduardas_m: if kido has it working in asteroid, then steal his recipes10:35
eduardas_mr0kk3rz: well, I have been aware of his work for a while... my problem with his recipes is that one must pull in quite a few packages (not just buteo-mtp), i. e.  a lot of mer middleware that I  do not understand10:38
r0kk3rzyeah that happens10:38
r0kk3rzhe also probably has a more complicated use case than you10:39
eduardas_mr0kk3rz: well, after poking around with bitbake, this is how much one needs to satisfy just the dependencies specified in metadata:
eduardas_mto even get bitbake to start building buteo-mtp...10:53
eduardas_mand most of those... I have no idea what they do :D10:53
r0kk3rzyou can probably cut a lot of those off11:03
r0kk3rzmce, dsme, ngfd11:04
r0kk3rzyou need more or a graph :)11:06
r0kk3rzwhich i think bitbake can do11:06
r0kk3rzyeah -g flag11:07
eduardas_mr0kk3rz: thank you for your help...will try to decouple stuff11:10
spiiroineduardas_m: I'd start by working in sailfish sdk (to initially have the build deps), then dropping everything that is not needed for building the standalone daemon from .pro files, then start weeding the sfos specific build requirements, and finally drop unwanted packages / files from packages from the spec file12:32
spiirointhe end result should be something that has just qt deps I guess12:33
r0kk3rzspiiroin: how dependent on usbmoded is it?12:33
spiiroinr0kk3rz: zero12:34
r0kk3rzah ok, so usbmoded delegates to the mtp service12:34
spiiroin... we've just changed how it works, so ...12:34
spiiroinit used to be so that:12:34
spiiroinusb moded -> programs gadget config & sends "mtp-mode" signal -> caught by msyncd that loads mtp plugin (from buteo-mtp source tree) -> mtp appears limping on the bus12:36
spiiroinnow it goes: usb moded disables usb,  preps gadget config, starts mtp daemon, waits for mtp daemon to configure endpoints -> usb moded enables usb -> mtp should be ready to serve when it is visible on bus12:37
spiiroinin neither case the mtp functionality itself (stuff from buteo-mtp) knows anything about usb-moded12:38
r0kk3rzbut it would still need something to handle the gadget config?12:39
r0kk3rzwhich isnt that hard, you can do it from a shell script12:39
spiiroinr0kk3rz: yes, but it does not need to be usb-moded12:39
r0kk3rzsounds reasonable12:40
spiiroinr0kk3rz: while debugging configfs vs what usb-moded did handle, I did this:
spiiroinkind of "usb-moded as shell script for sony xa2"12:42
r0kk3rzthat looks really useful actually12:43
spiiroinreview appreciated: usb mode selector tweaks12:59
eduardas_mthat is really useful information13:03
eduardas_mspiiroin: I am now trying out your script on my i.MX6 system... I do a mount -t configfs none /config and then ./ -v mtp_mode13:49
eduardas_mconfigfs mount point does not seem to get populated13:49
eduardas_monly output of script in verbose mode is D: Validate ConfigFS mountpoint13:50
eduardas_many idea what I am doing wrong?13:51
r0kk3rzeduardas_m: you have configfs kernel options set?13:52
eduardas_mr0kk3rz: yes13:52
r0kk3rziirc there should be at least one folder in the mount13:52
eduardas_mr0kk3rz: here is my mount command output
r0kk3rzyeah but what is in the /config dir13:55
r0kk3rzdo a mkdir -p usb_gadget/g113:56
eduardas_mmkdir: 'usb_gadget': Operation not permitted13:57
eduardas_msucceeded after I did a modprobe g_ffs (FunctionFS driver module)13:59
eduardas_mno idea what the logic here is13:59
r0kk3rzah yes of course14:09
r0kk3rzyou'll need to make sure the modules are loaded :P14:09
eduardas_mr0kk3rz: now I am stuck with mkdir: '/config/usb_gadget/g1/functions/ffs.mtp': Device or resource busy14:26
r0kk3rzeduardas_m: do a lsmod and check whats loaded14:41
eduardas_mr0kk3rz: configfs, libcomposite, usb_f_fs and g_ffs modules seem to be loaded this time14:51
r0kk3rzmtp module?14:52
eduardas_mr0kk3rz: only Android kernels have dedicated MTP modules, I thought buteo-mtp can function without that14:53
eduardas_mthe USB-MTP kernel module from Android (same thing used by Ubuntu Touch) was never accepted into mainline14:54
r0kk3rztypically this stuff is run with android kernels these days14:57
r0kk3rzand what you're currently doing is setting up kernel stuff through configfs14:57
eduardas_mr0kk3rz: yes, good point... it seems that if I try to create mtp.mtp in functions directory that works (but this uses the out-of-tree module I have used for Ubuntu touch experiments)15:02
eduardas_mI am not running an Android kernel, but merely a fork of the NXP 4.9 vendor kernel for i.MX615:03
eduardas_mspiiroin: does buteo-mtp still require an Android-specific driver?15:54
eduardas_mspiiroin: FUNCTION_MTP="ffs.mtp" in the script got me confused15:55
eduardas_mthe Android MTP gadget driver uses the mtp.mtp name
kimmolithe abbreviation FFS in MTP context is on point ?15:59
r0kk3rzthey are often said in context16:04
spiiroineduardas_m: that script is "investigating how configfs goes in general and specifically sony xa2" i.e. details like ffs.mtp are "whatever worked in xa2"19:46
spiiroinIIRC all buteo-mtp needs is /dev/mtp/ep0 to write to - in sfos that is handled by dev-mtp.mount systemd unit19:49
spiiroin... but in addition to that the gadget config (whether it happens via android usb, configs, or kernel mods) must be sane & enabled too19:51

Generated by 2.14.0 by Marius Gedminas - find it at!