Have you tried with the config CONFIG_USB_G_ANDROID but not 
CONFIG_USB_FUNCTIONFS. The android.c will include f_fs.c to support the adb 
over usb functionfs. Or the since 3.14, it does not support use G_ANDROID 
to control all android related gadget functin? 

On Wednesday, March 18, 2015 at 7:14:52 AM UTC+8, Amit Pundir wrote:
>
> Hi, 
>
> On 4 March 2015 at 07:09, Guoyin Chen <guoyi...@gmail.com <javascript:>> 
> wrote: 
> > I am trying to use the branch linux-linaro-lsk-v3.14-android from Linaro 
> or 
> > android-3.14 from AOSP. It seems the adb cannot work with f_fs.c driver. 
> > 
>
> It's been a while but ADB over FunctionFS worked for me with 
> linux-linaro-lsk-v3.14-android and I don't see any reason why it 
> shouldn't work with android-3.14 as such. 
>
> Here are the set of instructions which worked for me: 
>
> 1) Enable FunctionFS in kernel, "Device Drivers -> USB Support -> USB 
> Gadget Support -> USB Gadget Driver -> Function Filesystem" and boot 
> with this additional bootarg "g_ffs.idVendor=0x18d1". 
>
> 2) Run following commands from Android shell: 
> $ su 
> # stop adbd 
> # mkdir /dev/usb-ffs 
> # mkdir /dev/usb-ffs/adb 
> # mount -o uid=2000,gid=2000 -t functionfs adb /dev/usb-ffs/adb 
> # start adbd 
>
> 3) Run adb shell from host computer to verify. 
>
> The trick above is that the adb FunctionFS mount path 
> "/dev/usb-ffs/adb" and set of supported VendorIDs e.g 
> "g_ffs.idVendor=0x18d1" are hardcoded in adbd. So we can not just set 
> any random path/values there. 
>
> Regards, 
> Amit Pundir 
>
> > Every time, you try the commands "mount -o uid=2000,gid=2000 -t 
> functionfs 
> > adb /dev/usb-ffs/adb", it will failed on no device found. 
> > 
> > in the function ffs_fs_mount(), it will try to look up a ffs_dev with 
> the 
> > name "adb". But the android gadget driver, there is not code to register 
> > such device to f_fs. 
> > 
> > In 3.10 kernel, the ffs_fs_mount() will worked even with a null ffs_dev 
> > returned by functionfs_acquire_dev_callback(dev_name), which defined in 
> > android.c. 
> > 
> > Should we have some code in android gadget driver to init a adb ffs_dev 
> as 
> > the one in g_ffs driver's gfs_init()? Or any better way to add adb 
> ffs_dev? 
> > 
> > 3.10 kernel: 
> > /* "mount -t functionfs dev_name /dev/function" ends up here */ 
> > 
> > static struct dentry * 
> > ffs_fs_mount(struct file_system_type *t, int flags, 
> >           const char *dev_name, void *opts) 
> > { 
> >     struct ffs_sb_fill_data data = { 
> >         .perms = { 
> >             .mode = S_IFREG | 0600, 
> >             .uid = GLOBAL_ROOT_UID, 
> >             .gid = GLOBAL_ROOT_GID, 
> >         }, 
> >         .root_mode = S_IFDIR | 0500, 
> >     }; 
> >     struct dentry *rv; 
> >     int ret; 
> >     void *ffs_dev; 
> >     struct ffs_data *ffs; 
> > 
> >     ENTER(); 
> > 
> > 
> >     ret = ffs_fs_parse_opts(&data, opts); 
> >     if (unlikely(ret < 0)) 
> >         return ERR_PTR(ret); 
> > 
> >     ffs = ffs_data_new(); 
> >     if (unlikely(!ffs)) 
> >         return ERR_PTR(-ENOMEM); 
> >     ffs->file_perms = data.perms; 
> > 
> >     ffs->dev_name = kstrdup(dev_name, GFP_KERNEL); 
> >     if (unlikely(!ffs->dev_name)) { 
> >         ffs_data_put(ffs); 
> >         return ERR_PTR(-ENOMEM); 
> >     } 
> > 
> >     ffs_dev = functionfs_acquire_dev_callback(dev_name); 
> >     if (IS_ERR(ffs_dev)) { 
> >         ffs_data_put(ffs); 
> >         return ERR_CAST(ffs_dev); 
> >     } 
> > 
> >     ffs->private_data = ffs_dev; 
> >     data.ffs_data = ffs; 
> > 
> >     rv = mount_nodev(t, flags, &data, ffs_sb_fill); 
> >     if (IS_ERR(rv) && data.ffs_data) { 
> >         functionfs_release_dev_callback(data.ffs_data); 
> >         ffs_data_put(data.ffs_data); 
> >     } 
> >     return rv; 
> > } 
> > 
> > 3.14 kernel: 
> > static struct dentry * 
> > ffs_fs_mount(struct file_system_type *t, int flags, 
> >           const char *dev_name, void *opts) 
> > { 
> >     struct ffs_sb_fill_data data = { 
> >         .perms = { 
> >             .mode = S_IFREG | 0600, 
> >             .uid = GLOBAL_ROOT_UID, 
> >             .gid = GLOBAL_ROOT_GID, 
> >         }, 
> >         .root_mode = S_IFDIR | 0500, 
> >     }; 
> >     struct dentry *rv; 
> >     int ret; 
> >     void *ffs_dev; 
> >     struct ffs_data *ffs; 
> > 
> >     ENTER(); 
> > 
> >     ret = ffs_fs_parse_opts(&data, opts); 
> >     if (unlikely(ret < 0)) 
> >         return ERR_PTR(ret); 
> > 
> >     ffs = ffs_data_new(); 
> >     if (unlikely(!ffs)) 
> >         return ERR_PTR(-ENOMEM); 
> >     ffs->file_perms = data.perms; 
> > 
> >     ffs->dev_name = kstrdup(dev_name, GFP_KERNEL); 
> >     if (unlikely(!ffs->dev_name)) { 
> >         ffs_data_put(ffs); 
> >         return ERR_PTR(-ENOMEM); 
> >     } 
> > 
> >     ffs_dev = ffs_acquire_dev(dev_name); 
> >     if (IS_ERR(ffs_dev)) { 
> >         ffs_data_put(ffs); 
> >         return ERR_CAST(ffs_dev); 
> >     } 
> >     ffs->private_data = ffs_dev; 
> >     data.ffs_data = ffs; 
> > 
> >     rv = mount_nodev(t, flags, &data, ffs_sb_fill); 
> >     if (IS_ERR(rv) && data.ffs_data) { 
> >         ffs_release_dev(data.ffs_data); 
> >         ffs_data_put(data.ffs_data); 
> >     } 
> >     return rv; 
> > } 
> > 
> > -- 
> > -- 
> > unsubscribe: android-kerne...@googlegroups.com <javascript:> 
> > website: http://groups.google.com/group/android-kernel 
> > --- 
> > You received this message because you are subscribed to the Google 
> Groups 
> > "Android Linux Kernel Development" group. 
> > To unsubscribe from this group and stop receiving emails from it, send 
> an 
> > email to android-kerne...@googlegroups.com <javascript:>. 
> > For more options, visit https://groups.google.com/d/optout. 
>

-- 
-- 
unsubscribe: android-kernel+unsubscr...@googlegroups.com
website: http://groups.google.com/group/android-kernel
--- 
You received this message because you are subscribed to the Google Groups 
"Android Linux Kernel Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-kernel+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to