Re: Running ADB on a "stock" distribution (g_ffs)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 05/21/2015 09:18 AM, Bastien Nocera wrote:
On Thu, 2015-05-21 at 08:42 +0200, Krzysztof Opasiak wrote:
On 05/20/2015 06:42 PM, Bastien Nocera wrote:
Hey,

After discussing this with Andrzej, I'm no closer to being able to
get
this working...

I'm trying to run adbd (the service that would usually run on an
Android phone in developer mode) on a stock distribution, on a
device
that used to run Windows 8 (and now a Fedora).

This is my version of adbd:
https://github.com/hadess/adbd/

This is the systemd service file I eventually want to use, but I'm
running those commands "by hand" right now, and they fail in the
same
way.

https://github.com/hadess/adbd/blob/master/adbd.service

I'm getting this error from adbd:
OPENING /dev/usb-ffs/adb/ep0 [ /dev/usb-ffs/adb/ep0: writing
strings failed: errno=16]

Using ffs-test from tools/usb/ffs-test.c I have the same problem.
Writing descriptors works, but writing strings throws -EBUSY.

Those are the options used (from /boot/config-4.1.0
-0.rc0.git13.2.fc22.i686)
CONFIG_USB_GADGET=m
CONFIG_USB_FUNCTIONFS_GENERIC=y
CONFIG_USB_GADGET_VBUS_DRAW=2
CONFIG_USB_GADGET_STORAGE_NUM_BUFFERS=2
CONFIG_USB_LIBCOMPOSITE=m
CONFIG_USB_F_ACM=m
CONFIG_USB_U_SERIAL=m
CONFIG_USB_F_SERIAL=m
CONFIG_USB_F_OBEX=m
CONFIG_USB_F_FS=m
CONFIG_USB_CONFIGFS=m
CONFIG_USB_CONFIGFS_F_FS=y
CONFIG_USB_FUNCTIONFS=m
CONFIG_USB_FUNCTIONFS_GENERIC=y
CONFIG_USB_G_SERIAL=m

Everything looks good. Before doing what I described below please remember to

$ modprobe libcomposite
$ mount none -t configfs /sys/kernel/config


Which comes from this error message:
https://github.com/hadess/adbd/blob/master/adb/usb_linux_client.c#L
275

It looks like this can only happen if the gadget FS was already
registered:
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tre
e/drivers/usb/gadget/legacy/g_ffs.c#n301

Any ideas?


Could you please try to use ConfigFS interface instead of using
g_ffs?

Could you explain how I would set that up? Is that the way:
http://www.spinics.net/lists/linux-usb/msg96121.html
?

Yes, you can use this instruction but I think that using libusbg[1] would be easier. Just edit gadget-ffs example to create only one instance of ffs function and pass adb as instance name.

if you have this ready you should run as follows:

$ gadget-ffs
$ mount adb -t functionfs <mountpoint>
$ adbd
$ sleep 1
$ echo `ls /sys/class/udc | tail -n 1` > /sys/kernel/config/usb_gadget/g1/UDC

Here are also some presentations[2][3] on how to use configfs/libusbg.


I have used this setup some time ago and it worked fine, so it
should be
a good method of checking if adbd is working properly.

(tools/usb/ffs-aio-example) with g_ffs instead of adbd and see what
happen.

ffs-test fails in the same way, as mentioned above.

Does one need specific hardware to make this work? This is a tablet,
so I usually use a USB OTG adapter to plug in keyboard/mouse/network,
but I unplug all this to run the test tool, or adbd.


Nope. hardware is being automatically selected (we simply take first free udc or return -ENODEV if no free udc).

You may check if you have an UDC in your system (check if /sys/class/udc dir is not empty)

BTW.
Which kernel version do you use?

I'm still on Linus' 4.1.0-rc0, but if anything relevant changed, I can
certainly update to a newer version.

Should be fine.


Footnotes:
1 - https://github.com/kopasiak/libusbg/

2 - http://events.linuxfoundation.org/sites/events/files/slides/Tame_the_USB_gadgets_takative_beast_Opasiak_Krzysztof_0.pdf

3 - http://events.linuxfoundation.org/sites/events/files/slides/LinuxConNA-Make-your-own-USB-gadget-Andrzej.Pietrasiewicz.pdf

--
Krzysztof Opasiak
Samsung R&D Institute Poland
Samsung Electronics
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux