![]() ![]() |
Jul 3 2006, 06:21 AM
Post
#1
|
|
|
Group: Members Posts: 13 Joined: 3-July 06 Member No.: 10,306 |
I have a board with USB slave 1.1, and Linux installed on it.
I have connected it with a PC through a USB cable. And I want to make the PC "know" the device? on the board(the kernel is 2.6.11): 1. start Linux 2. dd bs=1M count=8 if=/dev/zero /root/data (FAT32) 3. modprobe g_file_storage file=/root/data HERE IS THE ERROR MESSAGE: ***************************************** Using /lib/modules/2.6.11-XSBase27x/kernel/drivers/usb/gadget/g_file_storage.ko insmod: cannot insert `/lib/modules/2.6.11-XSBase27x/kernel/drivers/usb/gadget/g _file_storage.ko': Device or resource busy (-1): Device or resource busy modprobe: failed to load module g_file_storage ***************************************** which device is busy? Or what should I do before I "modprobe g_file_storage..."? |
|
|
|
Jul 3 2006, 06:27 AM
Post
#2
|
|
|
Group: Members Posts: 4,515 Joined: 25-October 03 From: Bath, UK Member No.: 464 |
How do you get a terminal prompt, not over a usb ethernet link hopefully?
Do you have g_ether loaded? If so, you'll need to remove it. Si |
|
|
|
Jul 5 2006, 12:14 AM
Post
#3
|
|
|
Group: Members Posts: 13 Joined: 3-July 06 Member No.: 10,306 |
Today I found g_ether is builded in.
SO I recompiled the kernel.Deselect g_ether and made FSG STORAGE a module. When I "modprobe g_file_storage file=/root/data" again, "Device busy" error disappear. Another error occur,and more confused: [root@emdoor 2.6.11-XSBase27x]# insmod g_file_storage file=/root/back_file Using /lib/modules/2.6.11-XSBase27x/kernel/drivers/usb/gadget/g_file_storage.ko insmod: cannot insert `/lib/modules/2.6.11-XSBase27x/kernel/drivers/usb/gadget/g_file_storage.ko': Unknown error 524 (-1): Unknown error 524 524 is for what? QUOTE(lardman @ Jul 3 2006, 06:27 AM)
|
|
|
|
Jul 5 2006, 12:35 AM
Post
#4
|
|
|
Group: Members Posts: 13 Joined: 3-July 06 Member No.: 10,306 |
Here is sth after dmesg:
[root@emdoor bin]# dmesg ........... ........... g_file_storage: Ignoring new-style parameters in presence of obsolete ones g_file_storage gadget: controller 'pxa27x_udc' not recognized g_file_storage gadget: unable to autoconfigure all endpoints |
|
|
|
Jul 5 2006, 03:03 AM
Post
#5
|
|
|
Group: Members Posts: 4,515 Joined: 25-October 03 From: Bath, UK Member No.: 464 |
I don't know, but a quick google turned up some posts and patches which might be of use:
http://www.nabble.com/pxa27x_udc-fails-w-g...l-t1036446.html Si |
|
|
|
Jul 6 2006, 10:14 PM
Post
#6
|
|
|
Group: Members Posts: 13 Joined: 3-July 06 Member No.: 10,306 |
Thanks for that. But the patch dosen't work.
And this time I make the g_file_storage module builed in while compling. Then make some changes in file_storage.c /**********************************************************************/ static char *file[MAX_LUNS] = {"/root/back_file", };/* changed*/ static int ro[MAX_LUNS] = {0, }; /**********************************************************************/ but while rebooting, it says unable to open "/root/back_file". ERROR WHILE REBOOTING: pxa27x_udc: version 23-Sep-2004 g_file_storage gadget: controller 'pxa27x_udc' not recognized g_file_storage gadget-lun0: unable to open backing file: /root/back_file the code related is here: static int open_backing_file(.............) { ....... ....... /* R/W if we can, R/O if we must */ ro = curlun->ro; if (!ro) { filp = filp_open(filename, O_RDWR | O_LARGEFILE, 0); if (-EROFS == PTR_ERR(filp)) ro = 1; } if (ro) filp = filp_open(filename, O_RDONLY | O_LARGEFILE, 0); if (IS_ERR(filp)) { LINFO(curlun, "unable to open backing file: %s\n", filename);/***/ return PTR_ERR(filp); } ....... ....... } the /root/back_file is created like this: [root@Bill ~]vi /root/back_file [root@Bill ~]dd bs=1M count=8 if=/dev/zero of=/root/back_file [root@Bill ~]fdisk -S 8 -H 16 -C 128 /root/disk Above is from llinux-usb.org/gadget/file_storage.html then [root@Bill ~]chmod 777 /root/back_file file_storage.c I have changed is attached QUOTE(lardman @ Jul 5 2006, 03:03 AM) I don't know, but a quick google turned up some posts and patches which might be of use:
http://www.nabble.com/pxa27x_udc-fails-w-g...l-t1036446.html Si |
|
|
|
Jul 10 2006, 03:25 AM
Post
#7
|
|
|
Group: Members Posts: 4,515 Joined: 25-October 03 From: Bath, UK Member No.: 464 |
What does filp indicate the error is?
Your file may need a filesystem, though I'm not altogether sure about that. In fact, it looks like the code doesn't even get this far. [root@Bill ~]fdisk -S 8 -H 16 -C 128 /root/disk /root/disk is not the backing file afaict... Si |
|
|
|
Jul 10 2006, 04:18 AM
Post
#8
|
|
|
Group: Members Posts: 13 Joined: 3-July 06 Member No.: 10,306 |
Oh, sorry.
Actually it is [root@Bill ~]fdisk -S 8 -H 16 -C 128 /root/back_file and the partition is created by fdisk in this step. The partitions information: Command(m for help) p Device Boot Start End Blocks Id System /root/back_file1 1 128 Linux maybe I should try mkXXfs /root/back_file. QUOTE(lardman @ Jul 10 2006, 03:25 AM)
|
|
|
|
Jul 10 2006, 02:57 PM
Post
#9
|
|
|
Group: Members Posts: 4,515 Joined: 25-October 03 From: Bath, UK Member No.: 464 |
I didn't notice it before, but this can't really be a good sign:
QUOTE g_file_storage gadget: controller 'pxa27x_udc' not recognized I'm not sure what could be causing this problem I'm afraid. Si |
|
|
|
Jul 10 2006, 07:29 PM
Post
#10
|
|
|
Group: Members Posts: 13 Joined: 3-July 06 Member No.: 10,306 |
In gadget/gadget_chips.h
#ifdef CONFIG_USB_GADGET_PXA27X #define gadget_is_pxa27x(g) !strcmp("pxa27x_udc", (g)->name) #else #define gadget_is_pxa27x(g) 0 #endif In gadget/file_storage.c if (................) else if(gadget_is_pxa(fsg->gadget)) mod_data.release = __constant_cpu_to_le16(0x0303); else if (gadget_is_sh(fsg->gadget)) mod_data.release = __constant_cpu_to_le16(0x0304); /* The sa1100 controller is not supported */ else if (gadget_is_goku(fsg->gadget)) mod_data.release = __constant_cpu_to_le16(0x0306); else if (gadget_is_mq11xx(fsg->gadget)) mod_data.release = __constant_cpu_to_le16(0x0307); else if (gadget_is_omap(fsg->gadget)) mod_data.release = __constant_cpu_to_le16(0x0308); else if (gadget_is_lh7a40x(gadget)) mod_data.release = __constant_cpu_to_le16 (0x0309); else { WARN(fsg, "controller '%s' not recognized\n", fsg->gadget->name); mod_data.release = __constant_cpu_to_le16(0x0399); } This has been fixed by: replace gadget_is_pxa(fsg->gadget) by (strcmp("pxa27x_udc", fsg->gadget->name)==0) I don't think anything changed,however, the error "controller not recognized" disappeared. QUOTE(lardman @ Jul 10 2006, 02:57 PM)
|
|
|
|
Jul 10 2006, 08:06 PM
Post
#11
|
|
|
Group: Members Posts: 13 Joined: 3-July 06 Member No.: 10,306 |
I have checked the error, error = PTR_ERR(filp)
error = -2 IN Linux/include/asm-generic/errno-base.h #ifndef _ASM_GENERIC_ERRNO_BASE_H #define _ASM_GENERIC_ERRNO_BASE_H #define EPERM 1 /* Operation not permitted */ #define ENOENT 2 /* No such file or directory */ #define ESRCH 3 /* No such process */ #define EINTR 4 /* Interrupted system call */ #define EIO 5 /* I/O error */ So why no such file or directory ?? QUOTE(lardman @ Jul 10 2006, 03:25 AM)
|
|
|
|
Jul 10 2006, 08:19 PM
Post
#12
|
|
|
Group: Members Posts: 13 Joined: 3-July 06 Member No.: 10,306 |
after dmesg,below is the information while rebooting.
Built 1 zonelists Kernel command line: console=ttyS0,115200 mem=64M root=1F02 rw PID hash table entries: 512 (order: 9, 8192 bytes) Console: colour dummy device 80x30 Dentry cache hash table entries: 16384 (order: 4, 65536 bytes) Inode-cache hash table entries: 8192 (order: 3, 32768 bytes) Memory: 64MB = 64MB total Memory: 62080KB available (2213K code, 391K data, 108K init) Calibrating delay loop... 519.37 BogoMIPS (lpj=2596864) Mount-cache hash table entries: 512 (order: 0, 4096 bytes) CPU: Testing write buffer coherency: ok NET: Registered protocol family 16 SCSI subsystem initialized usbcore: registered new driver usbfs usbcore: registered new driver hub NetWinder Floating Point Emulator V0.97 (double precision) JFFS2 version 2.2. © 2001-2003 Red Hat, Inc. Initializing Cryptographic API Console: switching to colour frame buffer device 80x30 IRQ54 (GPIO22): falling edges ads7843: touch screen driver initialized SA1100 Real Time Clock driver v1.00 ttyS0 at MMIO 0x40100000 (irq = 22) is a FFUART ttyS1 at MMIO 0x40700000 (irq = 20) is a STUART ttyS2 at MMIO 0x40200000 (irq = 21) is a BTUART io scheduler noop registered io scheduler anticipatory registered io scheduler deadline registered io scheduler cfq registered RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize PP_addr=0x1300 eth0: cs8900 rev K found at 0xf0000300 no EEPROM cs89x0: No EEPROM, relying on command line.... cs89x0 media RJ-45, IRQ 41, programmed I/O, MAC 00:0b:f4:2f:9b:e5 Probing flash0 at physical address 0x00000000 (32-bit bankwidth) flash0: Found 2 x16 devices at 0x0 in 32-bit bank Intel/Sharp Extended Query Table at 0x010A Intel/Sharp Extended Query Table at 0x010A Intel/Sharp Extended Query Table at 0x010A Intel/Sharp Extended Query Table at 0x010A Using buffer write method cfi_cmdset_0001: Erase suspend on write enabled 0: offset=0x0,size=0x10000,blocks=4 1: offset=0x40000,size=0x40000,blocks=255 flash0: 1 set(s) of 2 interleaved chips --> 16 partitions of 4096 KiB Using static partitions on flash0 Creating 3 MTD partitions on "flash0": 0x00000000-0x00040000 : "boot" 0x00040000-0x001c0000 : "kernel" 0x001c0000-0x04000000 : "rootfs" pxa27x-ohci pxa27x-ohci: new USB bus registered, assigned bus number 1 hub 1-0:1.0: USB hub found hub 1-0:1.0: 2 ports detected Initializing USB Mass Storage driver... usbcore: registered new driver usb-storage USB Mass Storage support registered. usbcore: registered new driver usbhid drivers/usb/input/hid-core.c: v2.0:USB HID core driver pxa27x_udc: version 23-Sep-2004 ***************andy_error = -2********* /*this is the error=PTR_ERR(filp)*/ g_file_storage gadget-lun0: unable to open backing file: /root/back_file mice: PS/2 mouse device common for all mice ac97_codec: AC97 Audio codec, id: CRY52 (Cirrus Logic CS4299 rev D) NET: Registered protocol family 2 IP: routing cache hash table of 512 buckets, 4Kbytes TCP established hash table entries: 4096 (order: 3, 32768 bytes) TCP bind hash table entries: 4096 (order: 2, 16384 bytes) TCP: Hash tables configured (established 4096 bind 4096) NET: Registered protocol family 1 VFS: Mounted root (jffs2 filesystem). Freeing init memory: 108K IRQ41 (GPIO9): rising edges VFS: Can't find an ext2 filesystem on dev ram0. ads7843 : open [pid=834] [root@emdoor ~]# |
|
|
|
Jul 10 2006, 10:44 PM
Post
#13
|
|
|
Group: Members Posts: 13 Joined: 3-July 06 Member No.: 10,306 |
rootfs is not mounted while open /root/back_file,according to the msg.
QUOTE(andyzn @ Jul 10 2006, 08:19 PM) pxa27x_udc: version 23-Sep-2004
***************andy_error = -2********* /*this is the error=PTR_ERR(filp)*/ g_file_storage gadget-lun0: unable to open backing file: /root/back_file mice: PS/2 mouse device common for all mice ac97_codec: AC97 Audio codec, id: CRY52 (Cirrus Logic CS4299 rev D) NET: Registered protocol family 2 IP: routing cache hash table of 512 buckets, 4Kbytes TCP established hash table entries: 4096 (order: 3, 32768 bytes) TCP bind hash table entries: 4096 (order: 2, 16384 bytes) TCP: Hash tables configured (established 4096 bind 4096) NET: Registered protocol family 1 VFS: Mounted root (jffs2 filesystem). Freeing init memory: 108K IRQ41 (GPIO9): rising edges VFS: Can't find an ext2 filesystem on dev ram0. ads7843 : open [pid=834] [root@emdoor ~]# |
|
|
|
Jul 11 2006, 01:05 AM
Post
#14
|
|
|
Group: Members Posts: 4,515 Joined: 25-October 03 From: Bath, UK Member No.: 464 |
I was going to suggest that.
Have you tried using g_file_storage as a stand-alone module? There are also lots of: QUOTE usbcore: registered new driver usbfs usbcore: registered new driver hub Which looks like the usb port is being used as a host - this is not what you want for mass storage. Assuming this is the same port, you may need to change it from host to client mode (unless this happens automatically...?). Si |
|
|
|
Jul 11 2006, 01:13 AM
Post
#15
|
|
|
Group: Members Posts: 13 Joined: 3-July 06 Member No.: 10,306 |
I am happy to say, my windows host could recognize the "Linux Usb mass storage " as a disk just now. But still could not be format as FAT OR FAT32 by windows host. And I have change the size of back_file to 32M.
I used the patch again and change some code from that patch. stupid me. pxa27x_udc.h is not used,. usb_eb_autoconfig() in file_storage.c is useless, I replace it with pxa2x_ep_config() in pxa27x_udc.h. Later I will write down all my experience. Thanks a lot. |
|
|
|
![]() ![]() |
|
Lo-Fi Version | Time is now: 19th May 2013 - 11:24 PM |