Re: [linux-usb-devel] [PATCH] USB: SisUSB2VGA: Lindent drivers/usb/misc/sisusbvga/sisusb_struct.h

2007-08-11 Thread Felipe Balbi
Hi,

On 8/10/07, David Brownell [EMAIL PROTECTED] wrote:
 On Friday 10 August 2007, Felipe Balbi wrote:

 Better indentation

 I don't think so.  This whole patch seems to make one
 type of change:


  -unsigned charSt_ModeID;
  -unsigned shortSt_ModeFlag;
  -unsigned charSt_StTableIndex;
  -unsigned charSt_CRT2CRTC;
  -unsigned charSt_ResInfo;
  -unsigned charVB_StTVFlickerIndex;
  -unsigned charVB_StTVEdgeIndex;
  -unsigned charVB_StTVYFilterIndex;
  -unsigned charSt_PDC;

 ... all neatly indented so the fields line up.

 TheProblemISeeWithThatCodeIsThatItUsesCamelCase.

Yeah, get rid of the CaMeLcAsE is in my TODO list for this driver...
I'll re-factor this patch and apply the get rid of CamelCase to the
other files...



  +unsigned char St_ModeID;
  +unsigned short St_ModeFlag;
  +unsigned char St_StTableIndex;
  +unsigned char St_CRT2CRTC;
  +unsigned char St_ResInfo;
  +unsigned char VB_StTVFlickerIndex;
  +unsigned char VB_StTVEdgeIndex;
  +unsigned char VB_StTVYFilterIndex;
  +unsigned char St_PDC;

 ... the fields stopped lining up.

 In that particular stretch it's not all that much worse, although
 it does seem harder to find the member names.  However, overall
 I couldn't agree this is an improvement.

 -
 This SF.net email is sponsored by: Splunk Inc.
 Still grepping through log files to find problems?  Stop.
 Now Search log events and configuration files using AJAX and a browser.
 Download your FREE copy of Splunk now   http://get.splunk.com/
 ___
 linux-usb-devel@lists.sourceforge.net
 To unsubscribe, use the last form field at:
 https://lists.sourceforge.net/lists/listinfo/linux-usb-devel



-- 
Best Regards,

Felipe Balbi
[EMAIL PROTECTED]

-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now   http://get.splunk.com/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


Re: [linux-usb-devel] [PATCH 0/9] SisUSB2VGA Cleanups

2007-08-10 Thread Felipe Balbi
Hi,

On 8/10/07, Felipe Balbi [EMAIL PROTECTED] wrote:
 The following patch series implements a series of cleanups in the sisusbvga
 driver.

 Still some stuff to do, but at least we can have better readability on the 
 code.

 If anyone has any comments, please do.

 TODO:
 * Remove unnecessary cleanups

Noted an error here... I meant #defines

Sorry

 * Lots of ifdefs
 * Remove 2 warnings
 * Convert hex constants into more meaninful defines
 * Use static inline {} on ifdef'ed functions and put them on header 
 files
 * Too many char *str = string; Try to find a better way of doing 
 this
 * Remove undef's
 * int *ptr's can become int i's
 * Others to come.

 Best Regards,

 Felipe Balbi
 [EMAIL PROTECTED]
 +55 92 2126-1003

 Kernel Developers Team



 -
 This SF.net email is sponsored by: Splunk Inc.
 Still grepping through log files to find problems?  Stop.
 Now Search log events and configuration files using AJAX and a browser.
 Download your FREE copy of Splunk now   http://get.splunk.com/
 ___
 linux-usb-devel@lists.sourceforge.net
 To unsubscribe, use the last form field at:
 https://lists.sourceforge.net/lists/listinfo/linux-usb-devel



-- 
Best Regards,

Felipe Balbi
[EMAIL PROTECTED]

-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now   http://get.splunk.com/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] [PATCH 8/9] USB: SisUSB2VGA: Lindent drivers/usb/misc/sisusbvga/sisusb_init.c

2007-08-10 Thread Felipe Balbi
From: Felipe Balbi [EMAIL PROTECTED]

Better indentation

Signed-off-by: Felipe Balbi [EMAIL PROTECTED]
---
 drivers/usb/misc/sisusbvga/sisusb_init.c |  262 +++---
 1 files changed, 133 insertions(+), 129 deletions(-)

diff --git a/drivers/usb/misc/sisusbvga/sisusb_init.c 
b/drivers/usb/misc/sisusbvga/sisusb_init.c
index 5d83582..273de5d 100644
--- a/drivers/usb/misc/sisusbvga/sisusb_init.c
+++ b/drivers/usb/misc/sisusbvga/sisusb_init.c
@@ -55,18 +55,17 @@
 /* POINTER INITIALIZATION*/
 /*/
 
-static void
-SiSUSB_InitPtr(struct SiS_Private *SiS_Pr)
+static void SiSUSB_InitPtr(struct SiS_Private *SiS_Pr)
 {
-   SiS_Pr-SiS_ModeResInfo   = SiSUSB_ModeResInfo;
-   SiS_Pr-SiS_StandTable= SiSUSB_StandTable;
+   SiS_Pr-SiS_ModeResInfo = SiSUSB_ModeResInfo;
+   SiS_Pr-SiS_StandTable = SiSUSB_StandTable;
 
-   SiS_Pr-SiS_SModeIDTable  = SiSUSB_SModeIDTable;
-   SiS_Pr-SiS_EModeIDTable  = SiSUSB_EModeIDTable;
-   SiS_Pr-SiS_RefIndex  = SiSUSB_RefIndex;
-   SiS_Pr-SiS_CRT1Table = SiSUSB_CRT1Table;
+   SiS_Pr-SiS_SModeIDTable = SiSUSB_SModeIDTable;
+   SiS_Pr-SiS_EModeIDTable = SiSUSB_EModeIDTable;
+   SiS_Pr-SiS_RefIndex = SiSUSB_RefIndex;
+   SiS_Pr-SiS_CRT1Table = SiSUSB_CRT1Table;
 
-   SiS_Pr-SiS_VCLKData  = SiSUSB_VCLKData;
+   SiS_Pr-SiS_VCLKData = SiSUSB_VCLKData;
 }
 
 /*/
@@ -75,21 +74,20 @@ SiSUSB_InitPtr(struct SiS_Private *SiS_Pr)
 
 static void
 SiS_SetReg(struct SiS_Private *SiS_Pr, unsigned long port,
-   unsigned short index, unsigned short data)
+  unsigned short index, unsigned short data)
 {
sisusb_setidxreg(SiS_Pr-sisusb, port, index, data);
 }
 
 static void
 SiS_SetRegByte(struct SiS_Private *SiS_Pr, unsigned long port,
-   unsigned short data)
+  unsigned short data)
 {
sisusb_setreg(SiS_Pr-sisusb, port, data);
 }
 
 static unsigned char
-SiS_GetReg(struct SiS_Private *SiS_Pr, unsigned long port,
-   unsigned short index)
+SiS_GetReg(struct SiS_Private *SiS_Pr, unsigned long port, unsigned short 
index)
 {
u8 data;
 
@@ -110,22 +108,22 @@ SiS_GetRegByte(struct SiS_Private *SiS_Pr, unsigned long 
port)
 
 static void
 SiS_SetRegANDOR(struct SiS_Private *SiS_Pr, unsigned long port,
-   unsigned short index, unsigned short DataAND,
-   unsigned short DataOR)
+   unsigned short index, unsigned short DataAND,
+   unsigned short DataOR)
 {
sisusb_setidxregandor(SiS_Pr-sisusb, port, index, DataAND, DataOR);
 }
 
 static void
 SiS_SetRegAND(struct SiS_Private *SiS_Pr, unsigned long port,
-   unsigned short index, unsigned short DataAND)
+ unsigned short index, unsigned short DataAND)
 {
sisusb_setidxregand(SiS_Pr-sisusb, port, index, DataAND);
 }
 
 static void
-SiS_SetRegOR(struct SiS_Private *SiS_Pr,unsigned long port,
-   unsigned short index, unsigned short DataOR)
+SiS_SetRegOR(struct SiS_Private *SiS_Pr, unsigned long port,
+unsigned short index, unsigned short DataOR)
 {
sisusb_setidxregor(SiS_Pr-sisusb, port, index, DataOR);
 }
@@ -134,8 +132,7 @@ SiS_SetRegOR(struct SiS_Private *SiS_Pr,unsigned long port,
 /*  HELPER: DisplayOn, DisplayOff*/
 /*/
 
-static void
-SiS_DisplayOn(struct SiS_Private *SiS_Pr)
+static void SiS_DisplayOn(struct SiS_Private *SiS_Pr)
 {
SiS_SetRegAND(SiS_Pr, SiS_Pr-SiS_P3c4, 0x01, 0xDF);
 }
@@ -144,8 +141,7 @@ SiS_DisplayOn(struct SiS_Private *SiS_Pr)
 /*HELPER: Init Port Addresses*/
 /*/
 
-static void
-SiSUSBRegInit(struct SiS_Private *SiS_Pr, unsigned long BaseAddr)
+static void SiSUSBRegInit(struct SiS_Private *SiS_Pr, unsigned long BaseAddr)
 {
SiS_Pr-SiS_P3c4 = BaseAddr + 0x14;
SiS_Pr-SiS_P3d4 = BaseAddr + 0x24;
@@ -168,8 +164,7 @@ SiSUSBRegInit(struct SiS_Private *SiS_Pr, unsigned long 
BaseAddr)
 /* HELPER: GetSysFlags   */
 /*/
 
-static void
-SiS_GetSysFlags(struct SiS_Private *SiS_Pr)
+static void SiS_GetSysFlags(struct SiS_Private *SiS_Pr)
 {
SiS_Pr-SiS_MyCR63 = 0x63;
 }
@@ -178,8 +173,7 @@ SiS_GetSysFlags(struct SiS_Private *SiS_Pr)
 /* HELPER: Init PCI  Engines*/
 /*/
 
-static void
-SiSInitPCIetc(struct SiS_Private *SiS_Pr)
+static void SiSInitPCIetc(struct SiS_Private *SiS_Pr)
 {
SiS_SetReg(SiS_Pr, SiS_Pr-SiS_P3c4, 0x20, 0xa1);
/*  - Enable 2D (0x40)
@@ -195,8 +189,7 @@ SiSInitPCIetc(struct SiS_Private *SiS_Pr)
 /*HELPER: SET SEGMENT

[linux-usb-devel] [PATCH 3/9] USB: SisUSB2VGA: Remove if 0'ed code

2007-08-10 Thread Felipe Balbi
From: Felipe Balbi [EMAIL PROTECTED]

Unused code should be removed. We don't need to increase
the size of the file with dead code inside if 0 statements.

Signed-off-by: Felipe Balbi [EMAIL PROTECTED]
---
 drivers/usb/misc/sisusbvga/sisusb.c  |   57 ---
 drivers/usb/misc/sisusbvga/sisusb.h  |4 +-
 drivers/usb/misc/sisusbvga/sisusb_con.c  |   47 ---
 drivers/usb/misc/sisusbvga/sisusb_init.c |   90 --
 4 files changed, 1 insertions(+), 197 deletions(-)

diff --git a/drivers/usb/misc/sisusbvga/sisusb.c 
b/drivers/usb/misc/sisusbvga/sisusb.c
index c33b121..4676520 100644
--- a/drivers/usb/misc/sisusbvga/sisusb.c
+++ b/drivers/usb/misc/sisusbvga/sisusb.c
@@ -1255,47 +1255,6 @@ static int sisusb_read_mem_bulk(struct sisusb_usb_data 
*sisusb, u32 addr,
addr += 4;
length -= 4;
}
-#if 0  /* That does not work, as EP 2 is an OUT EP! */
-   default:
-   CLEARPACKET(packet);
-   packet.header  = 0x001f;
-   packet.address = 0x01a0;
-   packet.data= 0x0006;
-   ret |= sisusb_send_bridge_packet(sisusb, 10,
-   packet, 0);
-   packet.header  = 0x001f;
-   packet.address = 0x01b0;
-   packet.data= (length  ~3) | 0x4000;
-   ret |= sisusb_send_bridge_packet(sisusb, 10,
-   packet, 0);
-   packet.header  = 0x001f;
-   packet.address = 0x01b4;
-   packet.data= addr;
-   ret |= sisusb_send_bridge_packet(sisusb, 10,
-   packet, 0);
-   packet.header  = 0x001f;
-   packet.address = 0x01a4;
-   packet.data= 0x0001;
-   ret |= sisusb_send_bridge_packet(sisusb, 10,
-   packet, 0);
-   if (userbuffer) {
-   ret |= sisusb_recv_bulk_msg(sisusb,
-   SISUSB_EP_GFX_BULK_IN,
-   (length  ~3),
-   NULL, userbuffer,
-   bytes_read, 0);
-   if (!ret) userbuffer += (*bytes_read);
-   } else {
-   ret |= sisusb_recv_bulk_msg(sisusb,
-   SISUSB_EP_GFX_BULK_IN,
-   (length  ~3),
-   kernbuffer, NULL,
-   bytes_read, 0);
-   if (!ret) kernbuffer += (*bytes_read);
-   }
-   addr += (*bytes_read);
-   length -= (*bytes_read);
-#endif
}
 
if (ret)
@@ -1395,22 +1354,6 @@ sisusb_readb(struct sisusb_usb_data *sisusb, u32 adr, u8 
*data)
return(sisusb_read_memio_byte(sisusb, SISUSB_TYPE_MEM, adr, data));
 }
 
-#if 0
-
-int
-sisusb_writew(struct sisusb_usb_data *sisusb, u32 adr, u16 data)
-{
-   return(sisusb_write_memio_word(sisusb, SISUSB_TYPE_MEM, adr, data));
-}
-
-int
-sisusb_readw(struct sisusb_usb_data *sisusb, u32 adr, u16 *data)
-{
-   return(sisusb_read_memio_word(sisusb, SISUSB_TYPE_MEM, adr, data));
-}
-
-#endif  /*  0  */
-
 int
 sisusb_copy_memory(struct sisusb_usb_data *sisusb, char *src,
u32 dest, int length, size_t *bytes_written)
diff --git a/drivers/usb/misc/sisusbvga/sisusb.h 
b/drivers/usb/misc/sisusbvga/sisusb.h
index 555fed0..dc04739 100644
--- a/drivers/usb/misc/sisusbvga/sisusb.h
+++ b/drivers/usb/misc/sisusbvga/sisusb.h
@@ -46,9 +46,7 @@
 /* For older kernels, support for text consoles is by default
  * off. To ensable text console support, change the following:
  */
-#if 0
-#define CONFIG_USB_SISUSBVGA_CON
-#endif
+/* #define CONFIG_USB_SISUSBVGA_CON */
 
 /* Version Information */
 
diff --git a/drivers/usb/misc/sisusbvga/sisusb_con.c 
b/drivers/usb/misc/sisusbvga/sisusb_con.c
index a2bf4cf..aca13b8 100644
--- a/drivers/usb/misc/sisusbvga/sisusb_con.c
+++ b/drivers/usb/misc/sisusbvga/sisusb_con.c
@@ -373,14 +373,6 @@ sisusbcon_putc(struct vc_data *c, int ch, int y, int x)
return;
 
/* sisusb-lock is down */
-
-   /* Don't need to put the character into buffer ourselves,
-* because the vt does this BEFORE calling us

[linux-usb-devel] [PATCH 4/9] USB: SisUSB2VGA: Mis-spelled word

2007-08-10 Thread Felipe Balbi
From: Felipe Balbi [EMAIL PROTECTED]

Trivial fix

Signed-off-by: Felipe Balbi [EMAIL PROTECTED]
---
 drivers/usb/misc/sisusbvga/sisusb.h |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/usb/misc/sisusbvga/sisusb.h 
b/drivers/usb/misc/sisusbvga/sisusb.h
index dc04739..7183e76 100644
--- a/drivers/usb/misc/sisusbvga/sisusb.h
+++ b/drivers/usb/misc/sisusbvga/sisusb.h
@@ -44,7 +44,7 @@
 #include linux/mutex.h
 
 /* For older kernels, support for text consoles is by default
- * off. To ensable text console support, change the following:
+ * off. To enable text console support, change the following:
  */
 /* #define CONFIG_USB_SISUSBVGA_CON */
 
-- 
1.5.3.rc4.24.g5b56a


-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now   http://get.splunk.com/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] [PATCH 2/9] USB: SisUSB2VGA: Convert printk to dev_* macros

2007-08-10 Thread Felipe Balbi
From: Felipe Balbi [EMAIL PROTECTED]

This patch convert printk entries to dev_* macros, this provide better
debugging and better readability to the code.

Signed-off-by: Felipe Balbi [EMAIL PROTECTED]
---
 drivers/usb/misc/sisusbvga/sisusb.c |  111 +--
 drivers/usb/misc/sisusbvga/sisusb_con.c |   10 +--
 2 files changed, 34 insertions(+), 87 deletions(-)

diff --git a/drivers/usb/misc/sisusbvga/sisusb.c 
b/drivers/usb/misc/sisusbvga/sisusb.c
index 3db48d0..c33b121 100644
--- a/drivers/usb/misc/sisusbvga/sisusb.c
+++ b/drivers/usb/misc/sisusbvga/sisusb.c
@@ -1003,16 +1003,10 @@ static int sisusb_write_mem_bulk(struct sisusb_usb_data 
*sisusb, u32 addr,
if (ret) {
msgcount++;
if (msgcount  500)
-   printk(KERN_ERR
-   sisusbvga[%d]: Wrote %zd of 
-   %d bytes, error %d\n,
-   sisusb-minor, *bytes_written,
-   length, ret);
+   dev_err(sisusb-sisusb_dev-dev, 
Wrote %zd of %d bytes, error %d\n,
+   *bytes_written, length, ret);
else if (msgcount == 500)
-   printk(KERN_ERR
-   sisusbvga[%d]: Too many errors
-   , logging stopped\n,
-   sisusb-minor);
+   dev_err(sisusb-sisusb_dev-dev, Too 
many errors, logging stopped\n);
}
addr += (*bytes_written);
length -= (*bytes_written);
@@ -1446,10 +1440,10 @@ sisusb_testreadwrite(struct sisusb_usb_data *sisusb)
 sisusb_copy_memory(sisusb, srcbuffer, sisusb-vrambase, 7, dummy);
 
 for(i = 1; i = 7; i++) {
-printk(KERN_DEBUG sisusb: rwtest %d bytes\n, i);
+dev_dbg(sisusb-sisusb_dev-dev, sisusb: rwtest %d bytes\n, i);
sisusb_read_memory(sisusb, destbuffer, sisusb-vrambase, i, dummy);
for(j = 0; j  i; j++) {
-printk(KERN_DEBUG sisusb: rwtest read[%d] = %x\n, j, 
destbuffer[j]);
+dev_dbg(sisusb-sisusb_dev-dev, rwtest read[%d] = %x\n, j, 
destbuffer[j]);
}
 }
 }
@@ -2168,17 +2162,12 @@ sisusb_init_gfxcore(struct sisusb_usb_data *sisusb)
if (ramtype = 1) {
ret |= sisusb_get_sdram_size(sisusb, iret, bw, chab);
if (iret) {
-   printk(KERN_ERR sisusbvga[%d]: RAM size 
-   detection failed, 
-   assuming 8MB video RAM\n,
-   sisusb-minor);
+   dev_err(sisusb-sisusb_dev-dev,RAM size 
detection failed, assuming 8MB video RAM\n);
ret |= SETIREG(SISSR,0x14,0x31);
/* TODO */
}
} else {
-   printk(KERN_ERR sisusbvga[%d]: DDR RAM device found, 
-   assuming 8MB video RAM\n,
-   sisusb-minor);
+   dev_err(sisusb-sisusb_dev-dev, DDR RAM device 
found, assuming 8MB video RAM\n);
ret |= SETIREG(SISSR,0x14,0x31);
/* *** TODO *** */
}
@@ -2249,8 +2238,7 @@ sisusb_get_ramconfig(struct sisusb_usb_data *sisusb)
break;
}
 
-   printk(KERN_INFO sisusbvga[%d]: %dMB %s %s, bus width %d\n,
-   sisusb-minor, (sisusb-vramsize  20), ramtypetext1,
+   dev_info(sisusb-sisusb_dev-dev, %dMB %s %s, bus width %d\n, 
(sisusb-vramsize  20), ramtypetext1,
ramtypetext2[ramtype], bw);
 }
 
@@ -2510,8 +2498,7 @@ sisusb_open(struct inode *inode, struct file *file)
int subminor = iminor(inode);
 
if (!(interface = usb_find_interface(sisusb_driver, subminor))) {
-   printk(KERN_ERR sisusb[%d]: Failed to find interface\n,
-   subminor);
+   dev_err(sisusb-sisusb_dev-dev, Failed to find interface\n);
return -ENODEV;
}
 
@@ -2534,18 +2521,12 @@ sisusb_open(struct inode *inode, struct file *file)
if (sisusb-sisusb_dev-speed == USB_SPEED_HIGH) {
if (sisusb_init_gfxdevice(sisusb, 0)) {
mutex_unlock(sisusb-lock);
-   printk(KERN_ERR
-   sisusbvga[%d]: Failed to initialize 
-   device\n

[linux-usb-devel] [PATCH 0/9] SisUSB2VGA Cleanups

2007-08-10 Thread Felipe Balbi
The following patch series implements a series of cleanups in the sisusbvga
driver.

Still some stuff to do, but at least we can have better readability on the code.

If anyone has any comments, please do.

TODO:
* Remove unnecessary cleanups
* Lots of ifdefs
* Remove 2 warnings
* Convert hex constants into more meaninful defines
* Use static inline {} on ifdef'ed functions and put them on header 
files
* Too many char *str = string; Try to find a better way of doing this
* Remove undef's
* int *ptr's can become int i's
* Others to come.

Best Regards,

Felipe Balbi
[EMAIL PROTECTED]
+55 92 2126-1003

Kernel Developers Team



-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now   http://get.splunk.com/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] [PATCH] USB: SisUSB2VGA: Lindent drivers/usb/misc/sisusbvga/sisusb_struct.h

2007-08-10 Thread Felipe Balbi
From: Felipe Balbi [EMAIL PROTECTED]

Better indentation

Signed-off-by: Felipe Balbi [EMAIL PROTECTED]
---
 drivers/usb/misc/sisusbvga/sisusb_struct.h |  142 +---
 1 files changed, 67 insertions(+), 75 deletions(-)

diff --git a/drivers/usb/misc/sisusbvga/sisusb_struct.h 
b/drivers/usb/misc/sisusbvga/sisusb_struct.h
index 9def598..1c4240e 100644
--- a/drivers/usb/misc/sisusbvga/sisusb_struct.h
+++ b/drivers/usb/misc/sisusbvga/sisusb_struct.h
@@ -52,85 +52,78 @@
 #define _SISUSB_STRUCT_H_
 
 struct SiS_St {
-   unsigned char   St_ModeID;
-   unsigned short  St_ModeFlag;
-   unsigned char   St_StTableIndex;
-   unsigned char   St_CRT2CRTC;
-   unsigned char   St_ResInfo;
-   unsigned char   VB_StTVFlickerIndex;
-   unsigned char   VB_StTVEdgeIndex;
-   unsigned char   VB_StTVYFilterIndex;
-   unsigned char   St_PDC;
+   unsigned char St_ModeID;
+   unsigned short St_ModeFlag;
+   unsigned char St_StTableIndex;
+   unsigned char St_CRT2CRTC;
+   unsigned char St_ResInfo;
+   unsigned char VB_StTVFlickerIndex;
+   unsigned char VB_StTVEdgeIndex;
+   unsigned char VB_StTVYFilterIndex;
+   unsigned char St_PDC;
 };
 
-struct SiS_StandTable
-{
-   unsigned char   CRT_COLS;
-   unsigned char   ROWS;
-   unsigned char   CHAR_HEIGHT;
-   unsigned short  CRT_LEN;
-   unsigned char   SR[4];
-   unsigned char   MISC;
-   unsigned char   CRTC[0x19];
-   unsigned char   ATTR[0x14];
-   unsigned char   GRC[9];
+struct SiS_StandTable {
+   unsigned char CRT_COLS;
+   unsigned char ROWS;
+   unsigned char CHAR_HEIGHT;
+   unsigned short CRT_LEN;
+   unsigned char SR[4];
+   unsigned char MISC;
+   unsigned char CRTC[0x19];
+   unsigned char ATTR[0x14];
+   unsigned char GRC[9];
 };
 
 struct SiS_StResInfo_S {
-   unsigned short  HTotal;
-   unsigned short  VTotal;
+   unsigned short HTotal;
+   unsigned short VTotal;
 };
 
-struct SiS_Ext
-{
-   unsigned char   Ext_ModeID;
-   unsigned short  Ext_ModeFlag;
-   unsigned short  Ext_VESAID;
-   unsigned char   Ext_RESINFO;
-   unsigned char   VB_ExtTVFlickerIndex;
-   unsigned char   VB_ExtTVEdgeIndex;
-   unsigned char   VB_ExtTVYFilterIndex;
-   unsigned char   VB_ExtTVYFilterIndexROM661;
-   unsigned char   REFindex;
-   charROMMODEIDX661;
+struct SiS_Ext {
+   unsigned char Ext_ModeID;
+   unsigned short Ext_ModeFlag;
+   unsigned short Ext_VESAID;
+   unsigned char Ext_RESINFO;
+   unsigned char VB_ExtTVFlickerIndex;
+   unsigned char VB_ExtTVEdgeIndex;
+   unsigned char VB_ExtTVYFilterIndex;
+   unsigned char VB_ExtTVYFilterIndexROM661;
+   unsigned char REFindex;
+   char ROMMODEIDX661;
 };
 
-struct SiS_Ext2
-{
-   unsigned short  Ext_InfoFlag;
-   unsigned char   Ext_CRT1CRTC;
-   unsigned char   Ext_CRTVCLK;
-   unsigned char   Ext_CRT2CRTC;
-   unsigned char   Ext_CRT2CRTC_NS;
-   unsigned char   ModeID;
-   unsigned short  XRes;
-   unsigned short  YRes;
-   unsigned char   Ext_PDC;
-   unsigned char   Ext_FakeCRT2CRTC;
-   unsigned char   Ext_FakeCRT2Clk;
+struct SiS_Ext2 {
+   unsigned short Ext_InfoFlag;
+   unsigned char Ext_CRT1CRTC;
+   unsigned char Ext_CRTVCLK;
+   unsigned char Ext_CRT2CRTC;
+   unsigned char Ext_CRT2CRTC_NS;
+   unsigned char ModeID;
+   unsigned short XRes;
+   unsigned short YRes;
+   unsigned char Ext_PDC;
+   unsigned char Ext_FakeCRT2CRTC;
+   unsigned char Ext_FakeCRT2Clk;
 };
 
-struct SiS_CRT1Table
-{
-   unsigned char   CR[17];
+struct SiS_CRT1Table {
+   unsigned char CR[17];
 };
 
-struct SiS_VCLKData
-{
-   unsigned char   SR2B,SR2C;
-   unsigned short  CLOCK;
+struct SiS_VCLKData {
+   unsigned char SR2B, SR2C;
+   unsigned short CLOCK;
 };
 
-struct SiS_ModeResInfo
-{
-   unsigned short  HTotal;
-   unsigned short  VTotal;
-   unsigned char   XChar;
-   unsigned char   YChar;
+struct SiS_ModeResInfo {
+   unsigned short HTotal;
+   unsigned short VTotal;
+   unsigned char XChar;
+   unsigned char YChar;
 };
 
-struct SiS_Private
-{
+struct SiS_Private {
void *sisusb;
 
unsigned long IOAddress;
@@ -151,19 +144,18 @@ struct SiS_Private
unsigned long SiS_P3da;
unsigned long SiS_Part1Port;
 
-   unsigned char   SiS_MyCR63;
-   unsigned short  SiS_CRT1Mode;
-   unsigned short  SiS_ModeType;
-   unsigned short  SiS_SetFlag;
-
-   const struct SiS_StandTable *SiS_StandTable;
-   const struct SiS_St *SiS_SModeIDTable;
-   const struct SiS_Ext*SiS_EModeIDTable;
-   const struct SiS_Ext2   *SiS_RefIndex;
-   const struct SiS_CRT1Table  *SiS_CRT1Table;
-   const struct SiS_VCLKData   *SiS_VCLKData

[linux-usb-devel] [PATCH 7/9] USB: SisUSB2VGA: Lindent drivers/usb/misc/sisusbvga/sisusb_con.c

2007-08-10 Thread Felipe Balbi
From: Felipe Balbi [EMAIL PROTECTED]

Better indentation

Signed-off-by: Felipe Balbi [EMAIL PROTECTED]
---
 drivers/usb/misc/sisusbvga/sisusb_con.c |  493 +++
 1 files changed, 231 insertions(+), 262 deletions(-)

diff --git a/drivers/usb/misc/sisusbvga/sisusb_con.c 
b/drivers/usb/misc/sisusbvga/sisusb_con.c
index aca13b8..dbf8603 100644
--- a/drivers/usb/misc/sisusbvga/sisusb_con.c
+++ b/drivers/usb/misc/sisusbvga/sisusb_con.c
@@ -82,16 +82,14 @@ static struct sisusb_usb_data *mysisusbs[MAX_NR_CONSOLES];
 /* Forward declaration */
 static const struct consw sisusb_con;
 
-static inline void
-sisusbcon_memsetw(u16 *s, u16 c, unsigned int count)
+static inline void sisusbcon_memsetw(u16 * s, u16 c, unsigned int count)
 {
count /= 2;
while (count--)
sisusbcon_writew(c, s++);
 }
 
-static inline void
-sisusb_initialize(struct sisusb_usb_data *sisusb)
+static inline void sisusb_initialize(struct sisusb_usb_data *sisusb)
 {
/* Reset cursor and start address */
if (sisusb_setidxreg(sisusb, SISCR, 0x0c, 0x00))
@@ -112,8 +110,7 @@ sisusbcon_set_start_address(struct sisusb_usb_data *sisusb, 
struct vc_data *c)
sisusb_setidxreg(sisusb, SISCR, 0x0d, (sisusb-cur_start_addr  0xff));
 }
 
-void
-sisusb_set_cursor(struct sisusb_usb_data *sisusb, unsigned int location)
+void sisusb_set_cursor(struct sisusb_usb_data *sisusb, unsigned int location)
 {
if (sisusb-sisusb_cursor_loc == location)
return;
@@ -141,14 +138,12 @@ sisusb_set_cursor(struct sisusb_usb_data *sisusb, 
unsigned int location)
sisusb_setidxreg(sisusb, SISCR, 0x0f, (location  0xff));
 }
 
-static inline struct sisusb_usb_data *
-sisusb_get_sisusb(unsigned short console)
+static inline struct sisusb_usb_data *sisusb_get_sisusb(unsigned short console)
 {
return mysisusbs[console];
 }
 
-static inline int
-sisusb_sisusb_valid(struct sisusb_usb_data *sisusb)
+static inline int sisusb_sisusb_valid(struct sisusb_usb_data *sisusb)
 {
if (!sisusb-present || !sisusb-ready || !sisusb-sisusb_dev)
return 0;
@@ -156,8 +151,8 @@ sisusb_sisusb_valid(struct sisusb_usb_data *sisusb)
return 1;
 }
 
-static struct sisusb_usb_data *
-sisusb_get_sisusb_lock_and_check(unsigned short console)
+static struct sisusb_usb_data *sisusb_get_sisusb_lock_and_check(unsigned short
+   console)
 {
struct sisusb_usb_data *sisusb;
 
@@ -174,8 +169,7 @@ sisusb_get_sisusb_lock_and_check(unsigned short console)
 
mutex_lock(sisusb-lock);
 
-   if (!sisusb_sisusb_valid(sisusb) ||
-   !sisusb-havethisconsole[console]) {
+   if (!sisusb_sisusb_valid(sisusb) || !sisusb-havethisconsole[console]) {
mutex_unlock(sisusb-lock);
return NULL;
}
@@ -183,27 +177,23 @@ sisusb_get_sisusb_lock_and_check(unsigned short console)
return sisusb;
 }
 
-static int
-sisusb_is_inactive(struct vc_data *c, struct sisusb_usb_data *sisusb)
+static int sisusb_is_inactive(struct vc_data *c, struct sisusb_usb_data 
*sisusb)
 {
if (sisusb-is_gfx ||
-   sisusb-textmodedestroyed ||
-   c-vc_mode != KD_TEXT)
+   sisusb-textmodedestroyed || c-vc_mode != KD_TEXT)
return 1;
 
return 0;
 }
 
 /* con_startup console interface routine */
-static const char *
-sisusbcon_startup(void)
+static const char *sisusbcon_startup(void)
 {
return SISUSBCON;
 }
 
 /* con_init console interface routine */
-static void
-sisusbcon_init(struct vc_data *c, int init)
+static void sisusbcon_init(struct vc_data *c, int init)
 {
struct sisusb_usb_data *sisusb;
int cols, rows;
@@ -267,8 +257,7 @@ sisusbcon_init(struct vc_data *c, int init)
 }
 
 /* con_deinit console interface routine */
-static void
-sisusbcon_deinit(struct vc_data *c)
+static void sisusbcon_deinit(struct vc_data *c)
 {
struct sisusb_usb_data *sisusb;
int i;
@@ -289,7 +278,7 @@ sisusbcon_deinit(struct vc_data *c)
 
/* Free our font buffer if all consoles are gone */
if (sisusb-font_backup) {
-   for(i = 0; i  MAX_NR_CONSOLES; i++) {
+   for (i = 0; i  MAX_NR_CONSOLES; i++) {
if (sisusb-havethisconsole[c-vc_num])
break;
}
@@ -308,7 +297,7 @@ sisusbcon_deinit(struct vc_data *c)
 /* interface routine */
 static u8
 sisusbcon_build_attr(struct vc_data *c, u8 color, u8 intensity,
-   u8 blink, u8 underline, u8 reverse, u8 unused)
+u8 blink, u8 underline, u8 reverse, u8 unused)
 {
u8 attr = color;
 
@@ -319,8 +308,7 @@ sisusbcon_build_attr(struct vc_data *c, u8 color, u8 
intensity,
 
if (reverse)
attr = ((attr)  0x88) |
-  attr)  4) |
-  ((attr)  4))  0x77

[linux-usb-devel] [PATCH 1/9] USB: SisUSB2VGA: Whitespace Cleanups

2007-08-10 Thread Felipe Balbi
From: Felipe Balbi [EMAIL PROTECTED]

This patches clean some trailing whitespaces in sisusb2vga
driver.

Signed-off-by: Felipe Balbi [EMAIL PROTECTED]
---
 drivers/usb/misc/sisusbvga/sisusb.c|   26 +-
 drivers/usb/misc/sisusbvga/sisusb.h|6 +++---
 drivers/usb/misc/sisusbvga/sisusb_init.c   |2 +-
 drivers/usb/misc/sisusbvga/sisusb_init.h   |4 ++--
 drivers/usb/misc/sisusbvga/sisusb_struct.h |2 +-
 5 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/drivers/usb/misc/sisusbvga/sisusb.c 
b/drivers/usb/misc/sisusbvga/sisusb.c
index 9f37ba4..3db48d0 100644
--- a/drivers/usb/misc/sisusbvga/sisusb.c
+++ b/drivers/usb/misc/sisusbvga/sisusb.c
@@ -32,7 +32,7 @@
  * * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
- * Author: Thomas Winischhofer [EMAIL PROTECTED]
+ * Author: Thomas Winischhofer [EMAIL PROTECTED]
  *
  */
 
@@ -962,12 +962,12 @@ static int sisusb_write_mem_bulk(struct sisusb_usb_data 
*sisusb, u32 addr,
   packet.address = 0x0194;
   packet.data= addr;
   ret = sisusb_send_bridge_packet(sisusb, 10,
-   packet, 0);
+   packet, 0);
   packet.header  = 0x001f;
   packet.address = 0x0190;
   packet.data= (length  ~3);
   ret |= sisusb_send_bridge_packet(sisusb, 10,
-   packet, 0);
+   packet, 0);
   if (sisusb-flagb0 != 0x16) {
packet.header  = 0x001f;
packet.address = 0x0180;
@@ -1019,7 +1019,7 @@ static int sisusb_write_mem_bulk(struct sisusb_usb_data 
*sisusb, u32 addr,
}
 
if (ret)
-   break;
+   break;
 
}
 
@@ -1305,7 +1305,7 @@ static int sisusb_read_mem_bulk(struct sisusb_usb_data 
*sisusb, u32 addr,
}
 
if (ret)
-   break;
+   break;
}
 
return ret;
@@ -1533,9 +1533,9 @@ sisusb_clear_vram(struct sisusb_usb_data *sisusb, u32 
address, int length)
 #define SETIREGAND(r,i,a)  sisusb_setidxregand(sisusb, r, i, a)
 #define SETIREGANDOR(r,i,a,o)  sisusb_setidxregandor(sisusb, r, i, a, o)
 #define READL(a,d) sisusb_read_memio_long(sisusb, SISUSB_TYPE_MEM, a, d)
-#define WRITEL(a,d)sisusb_write_memio_long(sisusb, SISUSB_TYPE_MEM, a, d)
+#define WRITEL(a,d)sisusb_write_memio_long(sisusb, SISUSB_TYPE_MEM, a, d)
 #define READB(a,d) sisusb_read_memio_byte(sisusb, SISUSB_TYPE_MEM, a, d)
-#define WRITEB(a,d)sisusb_write_memio_byte(sisusb, SISUSB_TYPE_MEM, a, d)
+#define WRITEB(a,d)sisusb_write_memio_byte(sisusb, SISUSB_TYPE_MEM, a, d)
 
 static int
 sisusb_triggersr16(struct sisusb_usb_data *sisusb, u8 ramtype)
@@ -2008,7 +2008,7 @@ sisusb_set_default_mode(struct sisusb_usb_data *sisusb, 
int touchengines)
SETIREG(SISSR, 0x26, 0x00);
}
 
-   SETIREG(SISCR, 0x34, 0x44); /* we just set std mode #44 */
+   SETIREG(SISCR, 0x34, 0x44); /* we just set std mode #44 */
 
return ret;
 }
@@ -2942,7 +2942,7 @@ static int
 sisusb_handle_command(struct sisusb_usb_data *sisusb, struct sisusb_command *y,
unsigned long arg)
 {
-   int retval, port, length;
+   int retval, port, length;
u32 address;
 
/* All our commands require the device
@@ -3065,12 +3065,12 @@ sisusb_handle_command(struct sisusb_usb_data *sisusb, 
struct sisusb_command *y,
 
 static int
 sisusb_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
-   unsigned long arg)
+   unsigned long arg)
 {
struct sisusb_usb_data *sisusb;
struct sisusb_info x;
struct sisusb_command y;
-   int retval = 0;
+   int retval = 0;
u32 __user *argp = (u32 __user *)arg;
 
if (!(sisusb = (struct sisusb_usb_data *)file-private_data))
@@ -3095,7 +3095,7 @@ sisusb_ioctl(struct inode *inode, struct file *file, 
unsigned int cmd,
 
case SISUSB_GET_CONFIG:
 
-   x.sisusb_id = SISUSB_ID;
+   x.sisusb_id = SISUSB_ID;
x.sisusb_version= SISUSB_VERSION;
x.sisusb_revision   = SISUSB_REVISION;
x.sisusb_patchlevel = SISUSB_PATCHLEVEL;
@@ -3164,7 +3164,7 @@ static const struct file_operations usb_sisusb_fops

[linux-usb-devel] [PATCH 6/9] USB: SisUSB2VGA: Lindent drivers/usb/misc/sisusbvga/sisusb.h

2007-08-10 Thread Felipe Balbi
From: Felipe Balbi [EMAIL PROTECTED]

Better indentation

Signed-off-by: Felipe Balbi [EMAIL PROTECTED]
---
 drivers/usb/misc/sisusbvga/sisusb.h |  118 +--
 1 files changed, 58 insertions(+), 60 deletions(-)

diff --git a/drivers/usb/misc/sisusbvga/sisusb.h 
b/drivers/usb/misc/sisusbvga/sisusb.h
index 7183e76..d2d7872 100644
--- a/drivers/usb/misc/sisusbvga/sisusb.h
+++ b/drivers/usb/misc/sisusbvga/sisusb.h
@@ -8,27 +8,27 @@
  *
  * Otherwise, the following license terms apply:
  *
- * * Redistribution and use in source and binary forms, with or without
- * * modification, are permitted provided that the following conditions
- * * are met:
- * * 1) Redistributions of source code must retain the above copyright
- * *notice, this list of conditions and the following disclaimer.
- * * 2) Redistributions in binary form must reproduce the above copyright
- * *notice, this list of conditions and the following disclaimer in the
- * *documentation and/or other materials provided with the distribution.
- * * 3) The name of the author may not be used to endorse or promote products
- * *derived from this software without specific prior written permission.
- * *
- * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESSED OR
- * * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1) Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2) Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ * 3) The name of the author may not be used to endorse or promote products
+ *derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESSED OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
  * Author: Thomas Winischhofer [EMAIL PROTECTED]
  *
@@ -72,7 +72,7 @@
 #define SISUSB_IBUF_SIZE  0x01000
 #define SISUSB_OBUF_SIZE  0x1  /* fixed */
 
-#define NUMOBUFS 8 /* max number of output buffers/output 
URBs */
+#define NUMOBUFS 8 /* max number of output buffers/output URBs */
 
 /* About endianness:
  *
@@ -103,7 +103,7 @@
 
 struct sisusb_usb_data;
 
-struct sisusb_urb_context {/* urb-context for outbound bulk URBs 
*/
+struct sisusb_urb_context {/* urb-context for outbound bulk URBs */
struct sisusb_usb_data *sisusb;
int urbindex;
int *actual_length;
@@ -114,16 +114,16 @@ struct sisusb_usb_data {
struct usb_interface *interface;
struct kref kref;
wait_queue_head_t wait_q;   /* for syncind and timeouts */
-   struct mutex lock;  /* general race avoidance */
-   unsigned int ifnum; /* interface number of the USB device */
-   int minor;  /* minor (for logging clarity) */
-   int isopen; /* !=0 if open */
-   int present;/* !=0 if device is present on the bus 
*/
-   int ready;  /* !=0 if device is ready for userland 
*/
+   struct mutex lock;  /* general race avoidance */
+   unsigned int ifnum; /* interface number of the USB device */
+   int minor;  /* minor (for logging clarity) */
+   int isopen; /* !=0 if open */
+   int present;/* !=0 if device

[linux-usb-devel] Reseting USB HCD

2007-08-07 Thread Felipe Balbi
Hello all,

Is there a way of reseting USB HCD from userspace without removing the
kernel module?

I can see there's a method for reseting the controller (ehci_reset in
my case) but it's called only when the device is first probed or as an
error recovery method, am I right?

David, I saw you're the one who implemented ehci controller support on
linux, so do you remember coding such support? A way to reset the
controller from userspace? Some ioctl? some sysfs interface? Is there
any plans for that?


thanks in advance

-- 
Best Regards,

Felipe Balbi
[EMAIL PROTECTED]

-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now   http://get.splunk.com/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


Re: [linux-usb-devel] Reseting USB HCD

2007-08-07 Thread Felipe Balbi
Hi,

On 8/7/07, David Brownell [EMAIL PROTECTED] wrote:
 On Tuesday 07 August 2007, Felipe Balbi wrote:
  Hello all,
 
  Is there a way of reseting USB HCD from userspace without removing the
  kernel module?

 No.  That would reset the entire bus ... which should only be done
 after cleanly disconnecting all devices on that bus.


  I can see there's a method for reseting the controller (ehci_reset in
  my case) but it's called only when the device is first probed or as an
  error recovery method, am I right?

 Right.


  David, I saw you're the one who implemented ehci controller support on
  linux, so do you remember coding such support? A way to reset the
  controller from userspace? Some ioctl? some sysfs interface? Is there
  any plans for that?

 No past, current, or uture plans.  Why would you want such a thing?

I'm reading (and implementing) the USB Command Verifier Compliance
Test Specification, on page 19 it gives me 3 starting states which
I'll be using to issue the tests, those are Default State, Address
State and Configured State, in order to achieve the Configured
State I'd follow these steps:

Configured State: The device is enumerated using the following procedure.
1. Reset the USB host controller.
2. For each port on the USB host controller turn on port power.
3. Sleep for 1 Second.
4. Drive port reset on each host port. Sleep for 50 milliseconds.
Clear port reset.
5. Check host port enable.
6. If host port is enabled enumerate the device on the port.
7. Issue a valid set configuration command for the configuration to be tested.
8. Issue a valid get configuration command and verify that the correct
configuration is returned.

I can issue every single step here but the 1st one. But if the only
way to do it is removing the module and modprobe'ing it again, I can
live with that. A way to do it through sysfs or ioctl() would be nice
though...


 - Dave



-- 
Best Regards,

Felipe Balbi
[EMAIL PROTECTED]

-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now   http://get.splunk.com/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


Re: [linux-usb-devel] [Bugme-new] [Bug 8846] New: Ainol U60 MP4 player is not supported

2007-08-06 Thread Felipe Balbi
Hi,

On 8/6/07, Andrew Morton [EMAIL PROTECTED] wrote:
 On Mon,  6 Aug 2007 09:03:53 -0700 (PDT) [EMAIL PROTECTED] wrote:

  http://bugzilla.kernel.org/show_bug.cgi?id=8846
 
 Summary: Ainol U60 MP4 player is not supported
 Product: Drivers
 Version: 2.5
   KernelVersion: 2.6.22
Platform: All
  OS/Version: Linux
Tree: Mainline
  Status: NEW
Severity: normal
Priority: P1
   Component: USB
  AssignedTo: [EMAIL PROTECTED]
  ReportedBy: [EMAIL PROTECTED]
 
 
  Most recent kernel where this bug did not occur: None
  Distribution: Ubuntu Gutsy
  Hardware Environment:
  Software Environment:
  Problem Description: I'm using 2.6.22 kernel from Ubuntu. I just bought a 
  new
  mp4 player (Ainol U60). It is using Linux and it should behave as an usb 
  mass
  storage device. However, it refuses to mount.
  I posted hald verbose output there: http://pastebin.ca/647602
  Steps to reproduce:
 

I've answered this on kernel bugzilla, re-posting here:
Maybe a lsusb -v -d : would help us identifying the problem.
Also dmesg output with CONFIG_USB_STORAGE_DEBUG=y  would also be
really helpfull




 -
 This SF.net email is sponsored by: Splunk Inc.
 Still grepping through log files to find problems?  Stop.
 Now Search log events and configuration files using AJAX and a browser.
 Download your FREE copy of Splunk now   http://get.splunk.com/
 ___
 linux-usb-devel@lists.sourceforge.net
 To unsubscribe, use the last form field at:
 https://lists.sourceforge.net/lists/listinfo/linux-usb-devel



-- 
Best Regards,

Felipe Balbi
[EMAIL PROTECTED]

-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now   http://get.splunk.com/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


Re: [linux-usb-devel] ehci problem triggerable by storage

2007-08-03 Thread Felipe Balbi
On 8/3/07, Alan Stern [EMAIL PROTECTED] wrote:
 On Fri, 3 Aug 2007, Oliver Neukum wrote:

  Well, I've thought a bit about this. I know a hub is to blame. Even if I did
  learn what causes this specific error, it wouldn't help in the other cases.

 These sorts of problems tend to be _very_ hardware dependent.  That
 very same hub might work perfectly with someone else's computer or with
 a different USB drive.

  IMHO improving error handling is better than avoiding this fault.

 You mean error recovery.  It's not clear that we _can_ do anything
 other than what we are doing.  Longer recovery delays, perhaps.

 Maybe we need to reset the hub instead of the storage device.  But that
 is an unpleasant solution, especially if other devices are plugged into
 the hub.

 Do you have any other ideas?

This error is also happening if we echo suspend 
/sys/class/usb_device/usbdevX.Y/device/power/level

Unfortunately I only have FS USB Sniffer and can't go further.


 Alan Stern


 -
 This SF.net email is sponsored by: Splunk Inc.
 Still grepping through log files to find problems?  Stop.
 Now Search log events and configuration files using AJAX and a browser.
 Download your FREE copy of Splunk now   http://get.splunk.com/
 ___
 linux-usb-devel@lists.sourceforge.net
 To unsubscribe, use the last form field at:
 https://lists.sourceforge.net/lists/listinfo/linux-usb-devel



-- 
Best Regards,

Felipe Balbi
[EMAIL PROTECTED]

-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now   http://get.splunk.com/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


Re: [linux-usb-devel] [PATCH] USB: Only enable autosuspend by default on certain device classes

2007-08-03 Thread Felipe Balbi
On 8/3/07, Rogan Dawes [EMAIL PROTECTED] wrote:
 Matthew Garrett wrote:
  On Fri, Aug 03, 2007 at 01:44:02PM +0200, Oliver Neukum wrote:
  Am Freitag 03 August 2007 schrieb Matthew Garrett:
  It's certainly possible to do that, but it's also possible to have a
  userspace solution that whitelists devices. The question is whether the
  default kernel behaviour should be Save power, but potentially break
  some of my devices or Don't break my devices, but use some more
  powre.
  If both options have drawbacks, IMHO we follow the standard, which
  says that devices must support suspension.
 
  Except that lots of hardware doesn't follow the standard in this
  respect, otherwise we wouldn't be having this discussion. Personally, I
  think Will break an unknown number of devices is a significantly
  larger drawback than Will consume a small quantity of additional
  power.
 

 I guess the question could be phrased:

 Which one is more likely to conclude at some point?

 That is, if we blacklist by default, we consume that additional power
 indefinitely, because it is unlikely that people will report my machine
 uses 200mW more than I think it should, and thus we are unlikely to
 build up knowledge of exactly which devices/classes should be blacklisted.

 Compare that to:

 My USB printer broke, guess I'd better report it to LKML.

 The first option is unlikely to ever reach a satisfactory conclusion,
 whereas the second one is quite likely to flush out the guilty parties
 within a relatively short time.

Even though we should be following what the specs says and find other
ways of threating the messy devices. A sysfs entry for
enabling/disabling autosuspend and even to add devices to blacklist
seems quite nice to me.


 FWIW.

 Rogan

 -
 This SF.net email is sponsored by: Splunk Inc.
 Still grepping through log files to find problems?  Stop.
 Now Search log events and configuration files using AJAX and a browser.
 Download your FREE copy of Splunk now   http://get.splunk.com/
 ___
 linux-usb-devel@lists.sourceforge.net
 To unsubscribe, use the last form field at:
 https://lists.sourceforge.net/lists/listinfo/linux-usb-devel



-- 
Best Regards,

Felipe Balbi
[EMAIL PROTECTED]

-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now   http://get.splunk.com/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


Re: [linux-usb-devel] software unplug

2007-07-31 Thread Felipe Balbi
On 7/31/07, Lucio Crusca [EMAIL PROTECTED] wrote:
 Pete Zaitcev wrote:
  The symptoms you described point to a sequencer lock-up in the device.
  Your best bet is to change the brand of the dongle to a more reliable
  one.
 Any suggestion about which brands could be more reliable than others?

  If you work for a bigger OEM, you may be able to shop around and
  have vendors interested.
 Not exactly my case...

 Felipe Balbi wrote:
  This is not the right way to do it.
 Maybe, but I'd like a quick  dirty solution at the moment. Besides that I'm
 more than happy to recompile the kernel, provide you with the debug output
 and so on.

  Provide us more detailed
  information such as dmesg output.
 That's hard to retrieve. The problem is not reproducible, it happens once
 every several days, it never happened in test system but it's happening in
 a few production systems (not all). I suspect it happens only on those
 production systems where bluetooth traffic is higher, a situation hard to
 simulate for our resources during lab tests; however that's only a not so
 reliable guess.

How much data are we talking about... I could transfer around 500mb
between two pcs using crappy usb-bluetooth dongles... I bought
sometime ago...

No problems here... the problem could also be on obex-server... you're
probably using gnome-obex-server and friends... they may be logging
data somewhere... it could give you some hints... also check what's
happening on /var/log/messages.




  Another good information would be your kernel version.
 2.6.21.1-2 from Debian Lenny i386 (but the rest of the system is Etch).

 Lucio.


 -
 This SF.net email is sponsored by: Splunk Inc.
 Still grepping through log files to find problems?  Stop.
 Now Search log events and configuration files using AJAX and a browser.
 Download your FREE copy of Splunk now   http://get.splunk.com/
 ___
 linux-usb-devel@lists.sourceforge.net
 To unsubscribe, use the last form field at:
 https://lists.sourceforge.net/lists/listinfo/linux-usb-devel



-- 
Best Regards,

Felipe Balbi
[EMAIL PROTECTED]

-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now   http://get.splunk.com/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


Re: [linux-usb-devel] software unplug

2007-07-30 Thread Felipe Balbi
Hi Lucio,

On 7/30/07, Lucio Crusca [EMAIL PROTECTED] wrote:
 Hello *,

 I have a problem with bluetooth USB dongles.

 Scenario: a number of unattended systems have a USB bluetooth dongle that
 send files to nearby bluetooth devices. The systems are built on top of
 Debian GNU/Linux Etch i386 and use obexftp 0.19 to send files.

 Sometimes it happens that something between bluez and the hardware stops
 working, so in such cases my script issue hciconfig hci0 reset to
 recover and everything comes back ok. More rarely the reset method seems
 to be insufficient, because the device disappears even from lsusb output.
 The only solution I've found in such cases is to unplug and replug the
 dongle (even a few reboot cycles aren't enough). However that solution is
 not acceptable for me, since the systems should run unattended.

 Do you know how could I simulate unplug/replug events from software? Or
 any other solution that can run unattended?

This is not the right way to do it. Provide us more detailed
information such as dmesg output. But remember building your kernel
with  CONFIG_USB_DEBUG enabled.

We need to see why your device is going to sleep or whatever...

Another good information would be your kernel version.

Thanks


 Thanks in advance,

 Lucio.


 -
 This SF.net email is sponsored by: Splunk Inc.
 Still grepping through log files to find problems?  Stop.
 Now Search log events and configuration files using AJAX and a browser.
 Download your FREE copy of Splunk now   http://get.splunk.com/
 ___
 linux-usb-devel@lists.sourceforge.net
 To unsubscribe, use the last form field at:
 https://lists.sourceforge.net/lists/listinfo/linux-usb-devel



-- 
Best Regards,

Felipe Balbi
[EMAIL PROTECTED]

-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now   http://get.splunk.com/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


Re: [linux-usb-devel] software unplug

2007-07-30 Thread Felipe Balbi
Hi,

On 7/30/07, Alan Stern [EMAIL PROTECTED] wrote:
 On Mon, 30 Jul 2007, Lucio Crusca wrote:
 There is no way to simulate unplug/replug from software for devices
 attached directly to the computer.  However it is possible for devices
 plugged into some brands of hub.  See this web page:

Wouldn't cutting the power force a disconnect interrupt??
Maybe if he echo'es correctly on sysfs, he could achieve this...


 http://www.gniibe.org/ac-power-by-usb/ac-power-control.html

 Alan Stern


 -
 This SF.net email is sponsored by: Splunk Inc.
 Still grepping through log files to find problems?  Stop.
 Now Search log events and configuration files using AJAX and a browser.
 Download your FREE copy of Splunk now   http://get.splunk.com/
 ___
 linux-usb-devel@lists.sourceforge.net
 To unsubscribe, use the last form field at:
 https://lists.sourceforge.net/lists/listinfo/linux-usb-devel



-- 
Best Regards,

Felipe Balbi
[EMAIL PROTECTED]

-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now   http://get.splunk.com/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


Re: [linux-usb-devel] software unplug

2007-07-30 Thread Felipe Balbi
On 7/30/07, Alan Stern [EMAIL PROTECTED] wrote:
 On Mon, 30 Jul 2007, Felipe Balbi wrote:
 Lucio's problem is that the device has _already_ disconnected.
 Getting an additional disconnect interrupt won't make any difference.

yeah... off course :-p


  Maybe if he echo'es correctly on sysfs, he could achieve this...

 Nope.  You cannot turn off the USB bus power on the computer's USB
 ports no matter what you do; the hardware doesn't permit it.

and what about:
echo suspend  /sys/class/usb_device/usbdevX.Y/device/power/level  ???

where X is the bus number and Y is the device number, without the 00
in the beginning...

Ain't I cutting off power on that port??


-- 
Best Regards,

Felipe Balbi
[EMAIL PROTECTED]

-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now   http://get.splunk.com/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


Re: [linux-usb-devel] [PATCH 0/6] Composite Gadget Support

2007-07-29 Thread Felipe Balbi
 about that.  Wouldn't it simplify things if we didn't
 have to handle that case?

 ... and then there's the whole other speed config thing.
 There need to be both full speed and high speed configs, if
 the hardware supports high speed operation...



  When the ether is modprobe'ed first:
 
 (Device Decriptor)
   /\
  (Config 0) (Config 1)
  (eth config 0 + fsg config)  (eth config 1 + fsg config)

 Did you test that with MS-Windows?  The point about multiple
 configs that Microsoft demands that the first listed config
 be RNDIS.  (That's not necessarily config 0!!)  I don't recall
 any expectation that RNDIS + mass storage could work...


 -
 This SF.net email is sponsored by: Splunk Inc.
 Still grepping through log files to find problems?  Stop.
 Now Search log events and configuration files using AJAX and a browser.
 Download your FREE copy of Splunk now   http://get.splunk.com/
 ___
 linux-usb-devel@lists.sourceforge.net
 To unsubscribe, use the last form field at:
 https://lists.sourceforge.net/lists/listinfo/linux-usb-devel



-- 
Best Regards,

Felipe Balbi
[EMAIL PROTECTED]

-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now   http://get.splunk.com/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


Re: [linux-usb-devel] force USB_SPEED_FULL for device

2007-07-27 Thread Felipe Balbi
On 7/27/07, Gabriel Maganis [EMAIL PROTECTED] wrote:
 Hello,
 How could one force a device to be configured with
 USB_SPEED_FULL if it's a USB_SPEED_LOW device i.e. a Dell keyboard?

If it's a low_speed-only device it won't work as full speed. This
doesn't depend only on the controller/hub, but the usb device
controller chip on the keyboard.




 Thanks

 -
 This SF.net email is sponsored by: Splunk Inc.
 Still grepping through log files to find problems?  Stop.
 Now Search log events and configuration files using AJAX and a browser.
 Download your FREE copy of Splunk now   http://get.splunk.com/
 ___
 linux-usb-devel@lists.sourceforge.net
 To unsubscribe, use the last form field at:
 https://lists.sourceforge.net/lists/listinfo/linux-usb-devel



-- 
Best Regards,

Felipe Balbi
[EMAIL PROTECTED]

-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now   http://get.splunk.com/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


Re: [linux-usb-devel] [Bugme-new] [Bug 8770] New: Regression: hotplug events for usb-storage broken in 2.6.22

2007-07-16 Thread Felipe Balbi
:04 srv64 kernel: sd 6:0:0:0: [sdb] Attached SCSI removable disk
  Jul 16 16:50:04 srv64 kernel: sd 6:0:0:0: Attached scsi generic sg2 type 0
 
  rmmod usb-storage:
 
  Jul 16 16:51:12 srv64 kernel: usbcore: deregistering interface driver
  usb-storage
 
  modprobe usb-storage:
 
  Jul 16 16:51:40 srv64 kernel: Initializing USB Mass Storage driver...
  Jul 16 16:51:40 srv64 kernel: scsi7 : SCSI emulation for USB Mass Storage
  devices
  Jul 16 16:51:40 srv64 kernel: usbcore: registered new interface driver
  usb-storage
  Jul 16 16:51:40 srv64 kernel: USB Mass Storage support registered.
  Jul 16 16:51:51 srv64 kernel: usb 3-2: reset high speed USB device using
  ehci_hcd and address 2
  Jul 16 16:51:51 srv64 kernel: scsi 7:0:0:0: Direct-Access Corsair  Flash
  Voyager1100 PQ: 0 ANSI: 0 CCS
  Jul 16 16:51:51 srv64 kernel: sd 7:0:0:0: [sdb] 990208 512-byte hardware
  sectors (507 MB)
  Jul 16 16:51:51 srv64 kernel: sd 7:0:0:0: [sdb] Write Protect is off
  Jul 16 16:51:51 srv64 kernel: sd 7:0:0:0: [sdb] Assuming drive cache: write
  through
  Jul 16 16:51:51 srv64 kernel: sd 7:0:0:0: [sdb] 990208 512-byte hardware
  sectors (507 MB)
  Jul 16 16:51:51 srv64 kernel: sd 7:0:0:0: [sdb] Write Protect is off
  Jul 16 16:51:51 srv64 kernel: sd 7:0:0:0: [sdb] Assuming drive cache: write
  through
  Jul 16 16:51:51 srv64 kernel:  sdb: sdb1
  Jul 16 16:51:51 srv64 kernel: sd 7:0:0:0: [sdb] Attached SCSI removable disk
  Jul 16 16:51:51 srv64 kernel: sd 7:0:0:0: Attached scsi generic sg2 type 0
  Jul 16 16:51:52 srv64 hald: mounted /dev/sdb1 on behalf of uid 500
 
 
  Steps to reproduce:
 
  Run gnome-volume-manager (already running if gnome-session started)
  Plug usb stick.
  Expected: usb stick gets automounted without further intervention, as in 
  2.6.21
  Actual: usb stick does not get automounted. Gets automounted after cycle of
  rmmod usb-storage  modprobe usb-storage
 

 -
 This SF.net email is sponsored by DB2 Express
 Download DB2 Express C - the FREE version of DB2 express and take
 control of your XML. No limits. Just data. Click to get it now.
 http://sourceforge.net/powerbar/db2/
 ___
 linux-usb-devel@lists.sourceforge.net
 To unsubscribe, use the last form field at:
 https://lists.sourceforge.net/lists/listinfo/linux-usb-devel



-- 
Best Regards,

Felipe Balbi
[EMAIL PROTECTED]

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


Re: [linux-usb-devel] [PATCH 048/149] USB: whiteheat driver update

2007-07-13 Thread Felipe Balbi
On 7/13/07, Ragner Magalhaes [EMAIL PROTECTED] wrote:
 ext Greg Kroah-Hartman wrote:
  From: Oliver Neukum [EMAIL PROTECTED]
 

 
  @@ -683,24 +685,32 @@ static void whiteheat_close(struct usb_serial_port 
  *port, struct file * filp)
 
firm_close(port);
 
  +printk(KERN_ERRBefore processing rx_urbs_submitted.\n);
 I think you could to cut this printk ...

I don't think removing this printk is the best solution, but
converting it to some DBG macro would look better. Don't you think?

-- 
Best Regards,

Felipe Balbi
[EMAIL PROTECTED]

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


Re: [linux-usb-devel] PL2501 USB Host to Host

2007-07-11 Thread Felipe Balbi
Hi,

On 7/11/07, Tobias Arp [EMAIL PROTECTED] wrote:
 Hi,

 has someone build up succesfully a connection between a linux pc and a 
 windows pc with the Prolific 2501 Host to Host  Bridge? I use it in Network 
 mode but i can only establish a connection when both computer are using the 
 same OS (i.e. windows and windows or linux and linux). I tried all other 
 configurations of this chip (2303 compatible mode and 2502 mode) but it does 
 not work. Has someone an idea why it does not work ?
 Has someone used succesfully the 2502 mode ?

Can you provide debug information??
The output of dmesg for example. Also check if you have DEBUG messages
enabled for usb...


 Regards

 Tobias
 _
 In 5 Schritten zur eigenen Homepage. Jetzt Domain sichern und gestalten!
 Nur 3,99 EUR/Monat! http://www.maildomain.web.de/?mc=021114


 -
 This SF.net email is sponsored by DB2 Express
 Download DB2 Express C - the FREE version of DB2 express and take
 control of your XML. No limits. Just data. Click to get it now.
 http://sourceforge.net/powerbar/db2/
 ___
 linux-usb-devel@lists.sourceforge.net
 To unsubscribe, use the last form field at:
 https://lists.sourceforge.net/lists/listinfo/linux-usb-devel



-- 
Best Regards,

Felipe Balbi
[EMAIL PROTECTED]

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


Re: [linux-usb-devel] How to Suspend/Resume a usb device

2007-07-10 Thread Felipe Balbi
On 7/9/07, Alan Stern [EMAIL PROTECTED] wrote:
 On Mon, 9 Jul 2007, Felipe Balbi wrote:

  Hello all,
 
  How could I suspend/resume a usb device using libusb? I saw there's a
  function for reseting the device but what about suspending/resuming
  it?

 There's no way to do it using libusb or usbfs.  However you can suspend
 or resume a usb device using sysfs.  Starting with 2.6.22, you can do

 echo suspend /sys/bus/usb/devices/.../power/level

 (fill in the device ID) to suspend the device.  Replace the word
 suspend with on to force the device on permanently (autosuspend
 disabled), and use auto to return to normal operation.

 If you don't know the device ID but you do know its bus and device
 numbers -- which would be the case if you're starting from libusb --
 I believe you can get the same result using the path:

 /sys/class/usb_device/usbdevB.D/device/power/level

Thanks Alan, I'll try this one ;-)


  And also, does EHCI (on recent linux-linus' git tree) support
  SINGLE_STEP_GET_DESCRIPTOR and SINGLE_STEP_SET_FEATURE ???

 I don't recognize those terms.  What do they refer to?

You can check them at OTG Compliance Program, it's part of the
necessary certification tests for usb hosts. I don't think those are
otg specific but it could be.


 Alan Stern




-- 
Best Regards,

Felipe Balbi
[EMAIL PROTECTED]

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] How to Suspend/Resume a usb device

2007-07-09 Thread Felipe Balbi
Hello all,

How could I suspend/resume a usb device using libusb? I saw there's a
function for reseting the device but what about suspending/resuming
it?

And also, does EHCI (on recent linux-linus' git tree) support
SINGLE_STEP_GET_DESCRIPTOR and SINGLE_STEP_SET_FEATURE ???

Thanks in advance

-- 
Best Regards,

Felipe Balbi
[EMAIL PROTECTED]

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


Re: [linux-usb-devel] How to Suspend/Resume a usb device

2007-07-09 Thread Felipe Balbi
btw, it can also be using usb devicefs, anyone of these will help ;-)

thanks

On 7/9/07, Felipe Balbi [EMAIL PROTECTED] wrote:
 Hello all,

 How could I suspend/resume a usb device using libusb? I saw there's a
 function for reseting the device but what about suspending/resuming
 it?

 And also, does EHCI (on recent linux-linus' git tree) support
 SINGLE_STEP_GET_DESCRIPTOR and SINGLE_STEP_SET_FEATURE ???

 Thanks in advance

 --
 Best Regards,

 Felipe Balbi
 [EMAIL PROTECTED]



-- 
Best Regards,

Felipe Balbi
[EMAIL PROTECTED]

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


Re: [linux-usb-devel] urb status EOVERFLOW

2007-07-05 Thread Felipe Balbi
Hi Alan,

On 7/5/07, Alan Stern [EMAIL PROTECTED] wrote:
 On Wed, 4 Jul 2007, Felipe Balbi wrote:

   If the device firmware has gone crazy, reset the device, then port.
   This is what HID does, for example, because in it's illegal for
   HID devices to bunch reports together.
 
  and what about ending the session and starting all over again???
  seems to me that we don't know what's causing the babble in some
  cases... so the only way out is ending the session in the usb host
  controller itself.

 Resetting the device (or its port -- I can't quite tell exactly what
 Pete meant above) effectively _does_ start a new session.

 However with some devices, the only way to truly reset them is to
 unplug their power cable.  Not much the kernel can do then.

Some usb controllers (at least the one I've being working on) has a
Session Bit in some register. When you clear that bit you force the
controller to completely end the session. Is something like a software
disconnect.

When you write 1 again to that bit, the controller re-enumerates
everything attached.


 Alan Stern




-- 
Best Regards,

Felipe Balbi
[EMAIL PROTECTED]

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


Re: [linux-usb-devel] urb status EOVERFLOW

2007-07-04 Thread Felipe Balbi
hi pete,

On 7/4/07, Pete Zaitcev [EMAIL PROTECTED] wrote:
 On Wed, 4 Jul 2007 15:54:22 -0400, Jon Smirl [EMAIL PROTECTED] wrote:

  I'm working on the Ralink rt2x00usb driver. It is getting stuck in a
  state where the receive urb is returning -75, EOVERFLOW. It promptly
  ignores the error and resubmits the urb. Which comes back again with
  EOVERFLOW. What does this error mean and how should it be handled?

 A babble happens when a device tries to send more than the host has
 allocated to the transfer. If the device insists on sending full
 packets, reissuing the same transfer causes a persistent babble.

 The way to clear it depends on the cause of the babble.

 If your driver issues erroneously short request, fix your driver
 (check with usbmon, it shows the submission size).

 If the device firmware has gone crazy, reset the device, then port.
 This is what HID does, for example, because in it's illegal for
 HID devices to bunch reports together.

and what about ending the session and starting all over again???
seems to me that we don't know what's causing the babble in some
cases... so the only way out is ending the session in the usb host
controller itself.




 -- Pete

 -
 This SF.net email is sponsored by DB2 Express
 Download DB2 Express C - the FREE version of DB2 express and take
 control of your XML. No limits. Just data. Click to get it now.
 http://sourceforge.net/powerbar/db2/
 ___
 linux-usb-devel@lists.sourceforge.net
 To unsubscribe, use the last form field at:
 https://lists.sourceforge.net/lists/listinfo/linux-usb-devel



-- 
Best Regards,

Felipe Balbi
[EMAIL PROTECTED]

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


Re: [linux-usb-devel] looking for Lineo USB device stack

2007-07-03 Thread Felipe Balbi
Hi Stan,

On 7/3/07, Stan Marly [EMAIL PROTECTED] wrote:
 Hi,

 I am using a Cy7C67300 with uclinux 2.4.32. The device driver (usbd)
 developed by Lineo seems to be OK. Now I need to implement ACM device
 (serial) and ethernet device. It does not look easy to interface gadget
 and lineo usbd but I know that Lineo has developped in the past serial
 and ethernet functions for its usbd stack. Unfortunately Lineo does not
 exist anymore and I can not find the source code for the whole Lineo
 usbd stack, including ethernet and serial. Would someone have a link or
 a tar.gz to send to me ?
 Thanks for your help.

Clone linux-omap git tree and check these files:

drivers/usb/misc/cypress_cy7c63.c
drivers/usb/serial/cypress_m8.c

I'm not sure if this is what you want, but it could help.

Anyway, I don't think we already have Cypress UDC coded in
linux-omap... maybe you could help providing us with this code??

For HCD (host controller) seems you'll need to implement (O ||
E)HCI-cypress.c, or something like that, also.


 Best regards,

 Stan

 -
 This SF.net email is sponsored by DB2 Express
 Download DB2 Express C - the FREE version of DB2 express and take
 control of your XML. No limits. Just data. Click to get it now.
 http://sourceforge.net/powerbar/db2/
 ___
 linux-usb-devel@lists.sourceforge.net
 To unsubscribe, use the last form field at:
 https://lists.sourceforge.net/lists/listinfo/linux-usb-devel



-- 
Best Regards,

Felipe Balbi
[EMAIL PROTECTED]

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


Re: [linux-usb-devel] RT-friendly IRQ management in USB

2007-07-03 Thread Felipe Balbi
On 7/3/07, Jiri Kosina [EMAIL PROTECTED] wrote:
 On Mon, 2 Jul 2007, Alan Cox wrote:

   spin_lock_irqsave(some_lock, flags);
   ...
   spin_unlock(some_lock);
   usb_hcd_giveback_urb(hcd, urb);
   local_irq_restore(flags);
   or is there a better approach?
  Why not just bite the bullet and change the callback convention. The
  lock verification code should catch the cases that matter and which are
  overlooked on a code scan. You could also change the name of the
  callback to be sure it breaks anything out of tree that isn't fixed.

 Plus the code above code will break as soon as someone removes the
 preempt_disable() from spin_lock_irqsave() and preempt_enable() from
 spin_lock_irqrestore() -- which would in fact be a good optimization to do
 (local interrupts are disabled, so there is no need to disable
 preemption).

 But this has to wait until all the places in kernel which do this kind of
 incorrect pairing are fixed. I'd ceratinly vote for not adding any more of
 them.

 spin_lock_irqsave(some_lock, flags);
 ...
 preempt_disable();
 spin_unlock(some_lock);
 usb_hcd_giveback_urb(hcd, urb);
 local_irq_restore(flags);
 preempt_enable();

 Would make it working in both cases. Not a nice thing, indeed :)

So looks like we don't have (yet) a way to make it work nicely in both
cases... does anyone has a clue about how to implement this one??


 --
 Jiri Kosina

 -
 This SF.net email is sponsored by DB2 Express
 Download DB2 Express C - the FREE version of DB2 express and take
 control of your XML. No limits. Just data. Click to get it now.
 http://sourceforge.net/powerbar/db2/
 ___
 linux-usb-devel@lists.sourceforge.net
 To unsubscribe, use the last form field at:
 https://lists.sourceforge.net/lists/listinfo/linux-usb-devel



-- 
Best Regards,

Felipe Balbi
[EMAIL PROTECTED]

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


Re: [linux-usb-devel] Question about struct usb_hub

2007-07-03 Thread Felipe Balbi
Hi Allan,

let me get this same thread to ask you the following

On 7/3/07, Alan Stern [EMAIL PROTECTED] wrote:
 On Tue, 3 Jul 2007, jidong xiao wrote:

  What's the difference between event_bits and change_bits?
  I just cannot understand why we need two variables.
 
 
  188 struct usb_hub {
  ...
  205 unsigned long   event_bits[1];  /* status
  change bitmask */
  206 unsigned long   change_bits[1]; /* ports with
  logical connect
  207 status 
  change */
 
  Take following section for example,inside hub_events() sampled from
  drivers/usb/core/hub.c:
 
 2594 /* deal with port status changes */
 2595 for (i = 0; i  hub-descriptor-bNbrPorts; i++) {
 2596 connect_change = test_bit(i, 
  hub-change_bits);
 2597 if (!test_and_clear_bit(i+1, 
  hub-event_bits) 
 2598 !connect_change)
 2599 continue;
 
  Why do we need to test changes_bits and then test event_bits?

 event_bits records which ports have their bits set in the hub's
 interrupt URB.  change_bits records the ports for which we want to
 force a disable and re-enumeration.

How could I force my usb host controller to re-enumerate everything
attached on the bus through userspace?? would it be some sort of
control message???
thanks


 Sometimes the core needs to act as though a device has disconnected
 even when it really hasn't.  That's what change_bits is for.
 event_bits, on the other hand, tells us about real connect and
 disconnect events.  So the driver has to check both bit-vectors.

 Alan Stern


 -
 This SF.net email is sponsored by DB2 Express
 Download DB2 Express C - the FREE version of DB2 express and take
 control of your XML. No limits. Just data. Click to get it now.
 http://sourceforge.net/powerbar/db2/
 ___
 linux-usb-devel@lists.sourceforge.net
 To unsubscribe, use the last form field at:
 https://lists.sourceforge.net/lists/listinfo/linux-usb-devel



-- 
Best Regards,

Felipe Balbi
[EMAIL PROTECTED]

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


Re: [linux-usb-devel] Question about struct usb_hub

2007-07-03 Thread Felipe Balbi
On 7/3/07, Alan Stern [EMAIL PROTECTED] wrote:
 On Tue, 3 Jul 2007, Felipe Balbi wrote:

  Hi Allan,
 
  let me get this same thread to ask you the following

  How could I force my usb host controller to re-enumerate everything
  attached on the bus through userspace?? would it be some sort of
  control message???

 The easiest way is to unbind the hub driver from the root-hub device
 and then rebind it.  If B is the bus number, you can do:

 echo -n B-0:1.0 /sys/bus/usb/drivers/hub/unbind
 echo -n B-0:1.0 /sys/bus/usb/drivers/hub/bind


Thanks Alan...

 Alan Stern




-- 
Best Regards,

Felipe Balbi
[EMAIL PROTECTED]

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


Re: [linux-usb-devel] [PATCH] Fix OTG HNP for hub.c (USB OTG HNP (can you find any other appropriate TLAs?)

2007-05-29 Thread Felipe Balbi
On 5/30/07, Tony Lindgren [EMAIL PROTECTED] wrote:
 * David Brownell [EMAIL PROTECTED] [070529 16:04]:
  On Tuesday 29 May 2007, Tony Lindgren wrote:

 snip snip snip snip

   - Enable HNP early (later would be OK too);
   - Offer to do HNP if the peripheral wants to use it
 
  Host doesn't know anything about peripheral wants;
  from its perspective, this is an blind offer to go
  down the peripheral #2 path.
 
 
 (Peripheral maintains _both_ b_hnp_enable set by
 a_host and user preference on b_device on using
 b_hnp_enable)
 
  That user preference is problematic.  What do you
  end up with if that requirement for a user choice is
  removed ... ?

 How else do you tell when to use HNP then? It's the
 b-device that needs to have that configured in, and
 having HNP always enabled on b-device make sense either.

 I think it's designed to as a ways for b-device to
 request being a host, so it's not supposed to be automatic.
 If you want automatic host mode, then just use a-cable,
 right?

Yeah.. that's right... from my understanding it should be a user-request.
The natural way for changing roles would be a cable switching... but
we're lazy enough to do it.. so the the b-device requests (the user
requests) to become host during a small time-slice... we know it will
start and finish. Don't we?


 Anyways, I'll play with an OPT and send patches in few
 weeks, no need to do anything meanwhile unless somebody
 else is also working on HNP stuff.

 
   ... deletia ...
 
  Glad to know the mechanisms are working.  But right
  now I'm puzzled why musb_hdrc is misbehaving in
  host mode ... it's mangling descriptors as it reads
  them in.

 Which hardware? DaVinci or H4 with TUSB6010? At least
 on N800 the host mode can go through testusb -a.

 Tony



-- 
Best Regards,

Felipe Balbi
[EMAIL PROTECTED]

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


Re: [linux-usb-devel] [PATCH] Fix OTG HNP for hub.c (USB OTG HNP (can you find any other appropriate TLAs?)

2007-05-29 Thread Felipe Balbi
snip

  The behavioral difference would be that WHEN (not 'IF')
  the whitelist (which is very easily checked against product
  documentation) diverges from the list of configured drivers
  (no easy way to crosscheck that and docs) things would not
  act the same.

 I guess HNP should be offered for peripherals even if not
 on whitelist, but only peripherals on whitelist (with HNP
 or not) should be allowed.

Or maybe we run a set_feature (b_hnp_enabled) just before the
suspend... can we do that dave?? It doesn't seem really correct when
typing... but...

If I'm not wrong... every device can accept a b_hnp_enable set_feature
command... if the controller doesn't support it just return a
stall.. or something like that... so... we could just forget about
the whitelist for now.. can't we?

If the device supports HNP it will get the b_hnp_enable command and
after a_host enters in suspend mode... it will try to do HNP (if the
user wants...)


  This is more or less what you were trying to achieve,
  yes?  But it leads to surprising behavior in cases
  like:
 
 * hook up non-OTG peripheral #1 ... acts just
   the way you'd normally expect
 
 * hook up OTG peripheral #2 ... surprise!  it
   refuses to act as a peripheral at first.
 
  The principle of least astonishment argues that
  the peripheral #1 model should be followed for
  as long as possible.  Customer service calls would
  be a lot simpler too...

 Yeh I guess in that case it needs to wait for autosuspend
 until #1 is done.

 But if #2 is not on whitelist and can do HNP, then
 it just gets rejected and never gets it's HNP opportunity.

 Hmmm...

 Tony



-- 
Best Regards,

Felipe Balbi
[EMAIL PROTECTED]

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] How to talk to USB HCD Drivers?

2007-05-21 Thread Felipe Balbi
Hello all,

is there a way to use libusb to talk directly to hcd drivers?

what I'm wondering to do is to develop an application similar to the
USBHSET tool from usb.org in order to test embedded host devices.

I think that keep adding lots of sysfs interfaces is not the better
way to do it since I could use ioctls.

If any of you have a clue about how to do it... just point me the
header file and I'll try to do it... but any information/tip is
welcome :-)

-- 
Best Regards,

Felipe Balbi
[EMAIL PROTECTED]

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] Musb Bus Suspend

2007-05-02 Thread Felipe Balbi
Hello all,

What could I do to suspend the bus with musbmhdrc??
I saw that there's code for this and I have CONFIG_PM enabled, but the
controller never enters in suspend mode...

Any clue??

-- 
Best Regards,

Felipe Balbi
[EMAIL PROTECTED]

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] Weird Behavior on OTG

2007-04-27 Thread Felipe Balbi
Hello all,

I was testing OTG functionalities with tusb6010 (n800) with latest omap tree.
What i've found weird is that if the gadget side I build as modules,
the host side doesn't work.

Anybody knows how's that happening?

Thanks

-- 
Best Regards,

Felipe Balbi
[EMAIL PROTECTED]

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


Re: [linux-usb-devel] Weird Behavior on OTG

2007-04-27 Thread Felipe Balbi
Hi again,

The problem is even bigger. It only works when I build g_ether statically
weird.

On 4/27/07, Felipe Balbi [EMAIL PROTECTED] wrote:
 Hello all,

 I was testing OTG functionalities with tusb6010 (n800) with latest omap tree.
 What i've found weird is that if the gadget side I build as modules,
 the host side doesn't work.

 Anybody knows how's that happening?

 Thanks

 --
 Best Regards,

 Felipe Balbi
 [EMAIL PROTECTED]



-- 
Best Regards,

Felipe Balbi
[EMAIL PROTECTED]

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


Re: [linux-usb-devel] Weird Behavior on OTG

2007-04-27 Thread Felipe Balbi
Think you got it wrong.

When I build g_ether and g_file_storage as module. TUSB6010 stops
working (on otg mode).
When I build g_file_storage static, tusb stops working.

when I build g_ether static, tusb works again.

that's what's happening...

On 4/27/07, Hamish Moffatt [EMAIL PROTECTED] wrote:
 On Fri, Apr 27, 2007 at 03:17:42PM +0300, Felipe Balbi wrote:
  Hi again,
 
  The problem is even bigger. It only works when I build g_ether statically
  weird.
 
  On 4/27/07, Felipe Balbi [EMAIL PROTECTED] wrote:
   Hello all,
  
   I was testing OTG functionalities with tusb6010 (n800) with latest omap 
   tree.
   What i've found weird is that if the gadget side I build as modules,
   the host side doesn't work.
  
   Anybody knows how's that happening?

 How can you have g_ether static and the gadget driver as a module?
 The emulation (g_ether, g_serial etc) calls functions in the driver
 (usb_gadget_register_driver etc).

 Hamish
 --
 Hamish Moffatt VK3SB [EMAIL PROTECTED] [EMAIL PROTECTED]

 -
 This SF.net email is sponsored by DB2 Express
 Download DB2 Express C - the FREE version of DB2 express and take
 control of your XML. No limits. Just data. Click to get it now.
 http://sourceforge.net/powerbar/db2/
 ___
 linux-usb-devel@lists.sourceforge.net
 To unsubscribe, use the last form field at:
 https://lists.sourceforge.net/lists/listinfo/linux-usb-devel



-- 
Best Regards,

Felipe Balbi
[EMAIL PROTECTED]

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


Re: [linux-usb-devel] Weird Behavior on OTG

2007-04-27 Thread Felipe Balbi
Hi Hamish,

On 4/27/07, Hamish Moffatt [EMAIL PROTECTED] wrote:
 On Fri, Apr 27, 2007 at 03:34:28PM +0300, Felipe Balbi wrote:
 
  On 4/27/07, Hamish Moffatt [EMAIL PROTECTED] wrote:
   On Fri, Apr 27, 2007 at 03:17:42PM +0300, Felipe Balbi wrote:
Hi again,
   
The problem is even bigger. It only works when I build g_ether 
statically
weird.
   
On 4/27/07, Felipe Balbi [EMAIL PROTECTED] wrote:
 Hello all,

 I was testing OTG functionalities with tusb6010 (n800) with latest 
 omap tree.
 What i've found weird is that if the gadget side I build as modules,
 the host side doesn't work.

 Anybody knows how's that happening?
  
   How can you have g_ether static and the gadget driver as a module?
   The emulation (g_ether, g_serial etc) calls functions in the driver
   (usb_gadget_register_driver etc).

  Think you got it wrong.
 
  When I build g_ether and g_file_storage as module. TUSB6010 stops
  working (on otg mode).
  When I build g_file_storage static, tusb stops working.
 
  when I build g_ether static, tusb works again.
 
  that's what's happening...

 Please don't top post.

 So, you build g_ether static, omap_udc(?) as a module, and the host works?
 Does the gadget actually work? I suspect not, I can't see how it would
 since usb_gadget_register_driver() etc don't exist until you load the
 gadget module.

As I told on my first email, I'm using tusb6010. And it's my dual role
controller, it works as OTG, taking care of Host and Gadget modes.

The only thing being build as module/static are the gadget themselves.
g_ether.o and g_file_storage.o

 I don't have much experience with the usb gadget stuff. But perhaps you
 could be a bit clearer about which combinations actually work, and
 whether both host AND gadget work in each case?

tusb6010 + OTG Mode + g_ether static = this combination works.

tusb6010 + OTG mode + g_ether module = not working.

tusb6010 + OTG mode + g_file_storage static = not working

tusb6010 + OTG mode + g_file_storage module = not working.


These are the 4 scenarios I've tested.


-- 
Best Regards,

Felipe Balbi
[EMAIL PROTECTED]

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


Re: [linux-usb-devel] usb monitor

2007-04-03 Thread Felipe Balbi
Hello nesta,

On Tue, 2007-04-03 at 11:58 -0400, ext Wael Adel wrote:
 On 4/3/07, Jiri Kosina [EMAIL PROTECTED] wrote:
  On Tue, 3 Apr 2007, nesta wrote:
 
   i want to catch the usb traffic rate over the usb bus. is there any gui
   for linux that enables me from monitoring the traffic rate over the usb?
 
  Read Documentation/usb/usbmon.txt
 
  I am not confident about your gui requirement though :)
 
 how can i use usbmon module to calculate the rate of the traffic i
 sent over the usb bus?

I don't think you should be able to measure this directly... Don't even
have a clue about how to do it... :-p

Take a look ate Documentation/usb/usbmon.txt to see if it helps you.

Another thing to read is usb 1.1 and 2.0 specs... available at
www.usb.org

usb 2.0 specs tells that usb data rate should be around 480mbps




 
  --
  Jiri Kosina
 
 
 -
 Take Surveys. Earn Cash. Influence the Future of IT
 Join SourceForge.net's Techsay panel and you'll get the chance to share your
 opinions on IT  business topics through brief surveys-and earn cash
 http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
 ___
 linux-usb-devel@lists.sourceforge.net
 To unsubscribe, use the last form field at:
 https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
-- 
Best Regards,

Felipe Balbi
[EMAIL PROTECTED]

Nokia Institute of Technology - INdT
Kernel Developers Team

+55 92 2126 1003


signature.asc
Description: This is a digitally signed message part
-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] [PATCH] [TESTUSB] Add '-o' option

2007-04-02 Thread Felipe Balbi
[PATCH] Add -o option to redirect the output of testusb to a file.

Signed-off-by: Felipe Balbi [EMAIL PROTECTED]
---

--- testusb.c.orig  2007-04-02 13:42:33.0 -0400
+++ testusb.c   2007-04-02 14:42:19.0 -0400
@@ -37,6 +37,9 @@
 
 #defineTEST_CASES  30
 
+/* File pointer for output */
+FILE   *file;
+
 // FIXME make these public somewhere; usbdevfs.h?
 
 struct usbtest_param {
@@ -261,19 +264,22 @@
snprintf (buf, sizeof buf, error %d, err);
errno = err;
}
-   printf (%s test %d -- %d (%s)\n,
-   dev-name, i, errno, buf);
-   } else
-   printf (%s test %d, %4d.%.06d secs\n, dev-name, i,
-   (int) dev-param.duration.tv_sec,
-   (int) dev-param.duration.tv_usec);
-
-   fflush (stdout);
+   fprintf(file, %s test %d -- %d (%s)\n,
+   dev-name, i , errno, buf);
+   } else 
+   fprintf(file, %s test %d, %4d.%.06d secs\n, 
+   dev-name, i,
+   (int) dev-param.duration.tv_sec,
+   (int) dev-param.duration.tv_usec);
+   }
+   
+   fflush (file);
}
if (dev-forever)
goto restart;
 
close (fd);
+   fclose (file);
return arg;
 }
 
@@ -302,8 +308,9 @@
 
/* for easy use when hotplugging */
device = getenv (DEVICE);
+   file = stdout;
 
-   while ((c = getopt (argc, argv, D:ac:g:hns:t:v:)) != EOF)
+   while ((c = getopt (argc, argv, D:ac:g:hns:t:v:o:)) != EOF)
switch (c) {
case 'D':   /* device, if only one */
device = optarg;
@@ -343,13 +350,21 @@
if (param.vary  0)
goto usage;
continue;
+   case 'o': /* output file */
+   file = fopen (optarg, w);
+   if (file == NULL) {
+   printf (Can't open %s\n, optarg);
+   goto usage;
+   }
+   continue;
case '?':
case 'h':
default:
 usage:
fprintf (stderr, usage: %s [-an] [-D dev]\n
\t[-c iterations]  [-t testnum]\n
-   \t[-s packetsize] [-g sglen] [-v vary]\n,
+   \t[-s packetsize] [-g sglen] [-v vary]\n
+   \t[-o output_file]\n,
argv [0]);
return 1;
}

-- 
Best Regards,

Felipe Balbi
[EMAIL PROTECTED]

Nokia Institute of Technology - INdT
Kernel Developers Team

+55 92 2126 1003


signature.asc
Description: This is a digitally signed message part
-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] TestUSB Question

2007-04-02 Thread Felipe Balbi
Hello all,

A simple question:
Where can I find details about each test testusb is running? I need to
understand each of them to understand its outputs...


Thanks in advance.

-- 
Best Regards,

Felipe Balbi
[EMAIL PROTECTED]

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] Help with testusb

2007-03-30 Thread Felipe Balbi
Hello all,

I'm trying to run testusb on a tusb6010 device to test it's host mode
functionalities. I compiled the latest linux-omap gittree and enabled
the OTG mode.

I'm setting it to host mode by echoing host to
/sys/devices/platform/musb_hdrc/mode.

Here's my scenario:
1. 1 TUSB6010 set to host mode;
2. 2 Mini-b - A cable
3. 1 female - female USB-A cable;
4. 1 OMAP H2 running as gadget zero; (the testing device)
5. 1 selfpowered USB 2.0 HUB;
6. 1 Mass storage device to copy the testusb binary to device's /tmp;


My procedure:
1. Turn on TUSB6010;
2. Set it to host mode;
3. plug the mini-b - A cable to the USB HUB
4. plug the mass storage device to the hub
5. copy testusb binary to device's /tmp
6. mount usbfs on /proc/bus/usb
7. run ./testusb -a


Results:
I ran two tests, either gave me different error messages...


TEST #1
RESULTS:
/proc/bus/usb/001/004 test 0 -- 25 (error 25)

/proc/bus/usb/001/004 test 1 -- 25 (error 25)

/proc/bus/usb/001/004 test 2 -- 25 (error 25)

/proc/bus/usb/001/004 test 3 -- 25 (error 25)

/proc/bus/usb/001/004 test 4 -- 25 (error 25)

/proc/bus/usb/001/004 test 5 -- 25 (error 25)

/proc/bus/usb/001/004 test 6 -- 25 (error 25)

/proc/bus/usb/001/004 test 7 -- 25 (error 25)

/proc/bus/usb/001/004 test 8 -- 25 (error 25)

/proc/bus/usb/001/004 test 9 -- 25 (error 25)

/proc/bus/usb/001/004 test 10 -- 25 (error 25)

/proc/bus/usb/001/004 test 11 -- 25 (error 25)

/proc/bus/usb/001/004 test 12 -- 25 (error 25)

/proc/bus/usb/001/004 test 13 -- 25 (error 25)

/proc/bus/usb/001/004 test 14 -- 25 (error 25)

/proc/bus/usb/001/004 test 15 -- 25 (error 25)

/proc/bus/usb/001/004 test 16 -- 25 (error 25)

/proc/bus/usb/001/004 test 17 -- 25 (error 25)

/proc/bus/usb/001/004 test 18 -- 25 (error 25)

/proc/bus/usb/001/004 test 19 -- 25 (error 25)

/proc/bus/usb/001/004 test 20 -- 25 (error 25)

/proc/bus/usb/001/004 test 21 -- 25 (error 25)

/proc/bus/usb/001/004 test 22 -- 25 (error 25)

/proc/bus/usb/001/004 test 23 -- 25 (error 25)

/proc/bus/usb/001/004 test 24 -- 25 (error 25)

/proc/bus/usb/001/004 test 25 -- 25 (error 25)

/proc/bus/usb/001/004 test 26 -- 25 (error 25)

/proc/bus/usb/001/004 test 27 -- 25 (error 25)

/proc/bus/usb/001/004 test 28 -- 25 (error 25)

/proc/bus/usb/001/004 test 29 -- 25 (error 25)




TEST #2
RESULTS:
unknown speed   /proc/bus/usb/001/005

/proc/bus/usb/001/005 test 0 -- 113 (error 113)

/proc/bus/usb/001/005 test 1 -- 113 (error 113)

/proc/bus/usb/001/005 test 2 -- 113 (error 113)

/proc/bus/usb/001/005 test 3 -- 113 (error 113)

/proc/bus/usb/001/005 test 4 -- 113 (error 113)

/proc/bus/usb/001/005 test 5 -- 113 (error 113)

/proc/bus/usb/001/005 test 6 -- 113 (error 113)

/proc/bus/usb/001/005 test 7 -- 113 (error 113)

/proc/bus/usb/001/005 test 8 -- 113 (error 113)

/proc/bus/usb/001/005 test 9 -- 113 (error 113)

/proc/bus/usb/001/005 test 10 -- 113 (error 113)

/proc/bus/usb/001/005 test 11 -- 113 (error 113)

/proc/bus/usb/001/005 test 12 -- 113 (error 113)

/proc/bus/usb/001/005 test 13 -- 113 (error 113)

/proc/bus/usb/001/005 test 14 -- 113 (error 113)

/proc/bus/usb/001/005 test 15 -- 113 (error 113)

/proc/bus/usb/001/005 test 16 -- 113 (error 113)

/proc/bus/usb/001/005 test 17 -- 113 (error 113)

/proc/bus/usb/001/005 test 18 -- 113 (error 113)

/proc/bus/usb/001/005 test 19 -- 113 (error 113)

/proc/bus/usb/001/005 test 20 -- 113 (error 113)

/proc/bus/usb/001/005 test 21 -- 113 (error 113)

/proc/bus/usb/001/005 test 22 -- 113 (error 113)

/proc/bus/usb/001/005 test 23 -- 113 (error 113)

/proc/bus/usb/001/005 test 24 -- 113 (error 113)

/proc/bus/usb/001/005 test 25 -- 113 (error 113)

/proc/bus/usb/001/005 test 26 -- 113 (error 113)

/proc/bus/usb/001/005 test 27 -- 113 (error 113)

/proc/bus/usb/001/005 test 28 -- 113 (error 113)

/proc/bus/usb/001/005 test 29 -- 113 (error 113)





When I ran the same tests with my PC I've got better error messages:
take a look:

/testusb -D /proc/bus/usb/005/022
unknown speed   /proc/bus/usb/.usbfs/005/022
unknown speed   /proc/bus/usb/005/022
/proc/bus/usb/005/022 test 0,0.06 secs
/proc/bus/usb/005/022 test 1,0.912152 secs
/proc/bus/usb/005/022 test 2,0.717221 secs
/proc/bus/usb/005/022 test 3,0.888688 secs
/proc/bus/usb/005/022 test 4,0.535915 secs
/proc/bus/usb/005/022 test 5,   26.124402 secs
/proc/bus/usb/005/022 test 6,   15.757709 secs
/proc/bus/usb/005/022 test 7,   26.113765 secs
/proc/bus/usb/005/022 test 8,   16.130992 secs
/proc/bus/usb/005/022 test 9,2.161058 secs
/proc/bus/usb/005/022 test 10,4.366335 secs
/proc/bus/usb/005/022 test 11,   16.029610 secs
/proc/bus/usb/005/022 test 12,   16.001989 secs
/proc/bus/usb/005/022 test 13 -- 32 (Broken pipe)
/proc/bus/usb/005/022 test 14 -- 22 (Invalid argument)



What could I do to make this tests work ??
Thank you all...


-- 
Best Regards,

Felipe Balbi
[EMAIL PROTECTED]

-
Take Surveys. Earn Cash. Influence the Future of IT
Join

[linux-usb-devel] [patch 0/8] Composite Devices Support

2007-03-19 Thread Felipe Balbi
The following patch series add support for composite devices into the 
USB Gadget Framework.

* patch-composite-device-db.diff
* patch-composite-device-kconfig.diff
* patch-composite-device-db02.diff
* patch-composite-device-functions.diff
* patch-composite-device-serial-ifdef.diff
* patch-composite-device-ether-ifdef.diff
* patch-composite-device-file_storage-ifdef.diff
* patch-composite-device-omap_udc.diff

--
Best Regards,

Felipe Balbi
[EMAIL PROTECTED]

Nokia Institute of Technology - INdT
Kernel Developers Team

+55 92 2126 1003


-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] [patch 3/8] PATCH Modifications on David Brownells patch.

2007-03-19 Thread Felipe Balbi
Makes the code a little bit better and adds some functions to
the Composite Framework.

Signed-off-by: Felipe Balbi [EMAIL PROTECTED]
Signed-off-by: Ragner Magalhaes [EMAIL PROTECTED]
---

Index: linux-omap-2.6-ragner/drivers/usb/gadget/composite.c
===
--- linux-omap-2.6-ragner.orig/drivers/usb/gadget/composite.c
+++ linux-omap-2.6-ragner/drivers/usb/gadget/composite.c
@@ -1,3 +1,3 @@
 #define DEBUG 1
-// #define VERBOSE
+#define VERBOSE 1
 
@@ -24,2 +24,3 @@
 #include linux/usb_ch9.h
+#include linux/usb/cdc.h
 #include linux/usb_gadget.h
@@ -27,2 +28,3 @@
 
+#include gadget_chips.h
 
@@ -54,8 +56,11 @@
 /*-*/
+#define COMPOSITE_VERSION_NUM  0x0202
+#define COMPOSITE_NAME composite
+/* For file storage */
+#define DELAYED_STATUS (COMPOSITE_BUFSIZ + 999)
 
-/* big enough to hold our biggest descriptor */
-#define USB_BUFSIZ 512
-
+static const char shortname [] = COMPOSITE_NAME;
 
 static struct usb_composite_driver *composite;
+static struct usb_gadget_drivercomposite_driver;
 
@@ -94,3 +99,3 @@ config_buf(struct usb_composite_dev *cde
void*next = buf + USB_DT_CONFIG_SIZE;
-   int len = USB_BUFSIZ - USB_DT_CONFIG_SIZE;
+   int len = COMPOSITE_BUFSIZ - 
USB_DT_CONFIG_SIZE;
int hs;
@@ -139,2 +144,3 @@ static void composite_reset_config(
 ) {
+   struct usb_gadget   *gadget = cdev-gadget;
struct usb_function *f;
@@ -148,3 +154,4 @@ static void composite_reset_config(
list_for_each_entry (f, composite-functions, function) {
-   result = f-setup(cdev, req);
+   cdev-current_func = f;
+   result = f-setup(gadget, req);
if (result  0)
@@ -159,5 +166,6 @@ composite_set_config(struct usb_composit
 {
-   int result = 0, tmp;
+   int result = 0;
struct usb_gadget   *gadget = cdev-gadget;
struct usb_ctrlrequest  req;
+   struct usb_function *f;
 
@@ -181,18 +189,12 @@ composite_set_config(struct usb_composit
| USB_TYPE_STANDARD
-   | USB_RECIP_INTERFACE;
-   req.bRequest = USB_REQ_SET_INTERFACE;
-
-   for (tmp = 0; tmp  MAX_COMPOSITE_INTERFACES; tmp++) {
-   struct usb_function *f = cdev-interface[tmp];
+   | USB_RECIP_DEVICE;
+   req.bRequest= USB_REQ_SET_CONFIGURATION;
+   req.wValue  = COMPOSITE_CONFIG_VALUE;
 
-   if (!f)
-   continue;
-   req.wIndex = cpu_to_le16(tmp);
-   result = f-setup(cdev, req);
-   if (result  0) {
-   DBG(cdev, interface %d/%s alt 0-- %d\n,
-   tmp, f-name, result);
-   (void) composite_set_config(cdev, 0);
-   return result;
-   }
+   list_for_each_entry (f, composite-functions, function) {
+   cdev-current_func = f;
+   result = f-setup(gadget, req);
+   if (result  0)
+   DBG(cdev, set function configuration %s -- 
%d\n,
+   f-name, result);
}
@@ -219,3 +221,3 @@ composite_set_config(struct usb_composit
 static void
-composite_collect_langs(const struct usb_gadget_strings **sp, __le16 *buf)
+composite_collect_langs(struct usb_gadget_strings *sp, __le16 *buf)
 {
@@ -225,4 +227,4 @@ composite_collect_langs(const struct usb
 
-   while (*sp) {
-   s = *sp;
+   if (sp) {
+   s = sp;
language = cpu_to_le16(s-language);
@@ -230,7 +232,5 @@ composite_collect_langs(const struct usb
if (*tmp == language)
-   goto repeat;
+   return;
}
*tmp++ = language;
-repeat:
-   sp++;
}
@@ -239,3 +239,3 @@ repeat:
 static int composite_check_string(
-   const struct usb_gadget_strings **sp,
+   struct usb_gadget_strings *sp,
void*buf,
@@ -245,9 +245,9 @@ static int composite_check_string(
 {
-   const struct usb_gadget_strings *s;
+   struct usb_gadget_strings *s;
int value;
 
-   while (*sp) {
-   s = *sp++;
+   if (sp) {
+   s = sp;
if (s-language != language)
-   continue;
+   return -EINVAL

[linux-usb-devel] [patch 1/8] Add linux/usb/composite.h interfaces for composite gadget drivers:

2007-03-19 Thread Felipe Balbi
 +104,3 @@ fail:
 int
-usb_gadget_get_string (struct usb_gadget_strings *table, int id, u8 *buf)
+usb_gadget_get_string(const struct usb_gadget_strings *table, int id, u8 *buf)
 {
Index: linux-omap-2.6-ragner/include/linux/usb_gadget.h
===
--- linux-omap-2.6-ragner.orig/include/linux/usb_gadget.h
+++ linux-omap-2.6-ragner/include/linux/usb_gadget.h
@@ -855,3 +855,3 @@ struct usb_gadget_strings {
 /* put descriptor for string with that id into buf (buflen = 256) */
-int usb_gadget_get_string (struct usb_gadget_strings *table, int id, u8 *buf);
+int usb_gadget_get_string(const struct usb_gadget_strings *table, int id, u8 
*buf);
 

--
Best Regards,

Felipe Balbi
[EMAIL PROTECTED]

Nokia Institute of Technology - INdT
Kernel Developers Team

+55 92 2126 1003


-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] [patch 2/8] Kconfig Modifications for USB Composite Devices Support

2007-03-19 Thread Felipe Balbi
Signed-off-by: Felipe Balbi [EMAIL PROTECTED]
Signed-off-by: Ragner Magalhaes [EMAIL PROTECTED]
---

Index: linux-2.6/drivers/usb/gadget/Kconfig
===
--- linux-2.6.orig/drivers/usb/gadget/Kconfig
+++ linux-2.6/drivers/usb/gadget/Kconfig
@@ -274,2 +274,11 @@ choice
 
+config USB_COMPOSITE
+   tristate Composite Gadget Support
+   depends on USB_GADGET
+   help
+  A composite gadget is a device with more than one
+  interface.
+
+  This module adds support for this kind of device.
+
 config USB_ZERO
Index: linux-2.6/drivers/usb/gadget/Makefile
===
--- linux-2.6.orig/drivers/usb/gadget/Makefile
+++ linux-2.6/drivers/usb/gadget/Makefile
@@ -21,2 +21,4 @@ g_file_storage-objs   := file_storage.o u
epautoconf.o
+g_composite-objs   := composite_functions.o composite.o \
+   usbstring.o config.o epautoconf.o
 
@@ -32,2 +34,2 @@ obj-$(CONFIG_USB_G_SERIAL)+= g_serial.o
 obj-$(CONFIG_USB_MIDI_GADGET)  += g_midi.o
-
+obj-$(CONFIG_USB_COMPOSITE)+= g_composite.o

--
Best Regards,

Felipe Balbi
[EMAIL PROTECTED]

Nokia Institute of Technology - INdT
Kernel Developers Team

+55 92 2126 1003


-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] [patch 4/8] The Composite Gadget itself.

2007-03-19 Thread Felipe Balbi
This gadget is built using a generic approach.
To use this composite gadget, just load the gadget modules and plug-in
the USB Cable.

The g_midi.c file was not modified yet.

Will come in a separate patch.

Signed-off-by: Felipe Balbi [EMAIL PROTECTED]
Signed-off-by: Ragner Magalhaes [EMAIL PROTECTED]
---

Index: linux-omap-2.6-ragner/drivers/usb/gadget/composite_functions.c
===
--- /dev/null
+++ linux-omap-2.6-ragner/drivers/usb/gadget/composite_functions.c
@@ -0,0 +1,304 @@
+/*
+ * composite_functions.c -- USB OMAP Layer for Composite Device Support
+ *
+ * Copyright 2006 (C) Instituto Nokia de Tecnologia - INdT
+ *
+ * This software is distributed under the terms of the GNU General
+ * Public License (GPL) as published by the Free Software Foundation,
+ * either version 2 of the License of (at you option) any later version.
+ *
+ */
+
+#include linux/delay.h
+#include linux/device.h
+#include linux/errno.h
+#include linux/init.h
+#include linux/interrupt.h
+#include linux/ioport.h
+#include linux/kernel.h
+#include linux/list.h
+#include linux/module.h
+#include linux/moduleparam.h
+#include linux/sched.h
+#include linux/smp_lock.h
+#include linux/timer.h
+#include linux/utsname.h
+#include linux/usb_ch9.h
+#include linux/usb_gadget.h
+#include linux/usb/composite.h
+
+#include asm/byteorder.h
+#include asm/io.h
+#include asm/irq.h
+#include asm/semaphore.h
+#include asm/system.h
+#include asm/unaligned.h
+
+#include gadget_chips.h
+
+#define COMPOSITE_DESC Composite Driver
+#define COMPOSITE_VERSION  v1.0-alpha
+
+
+static const char driver_desc [] = COMPOSITE_DESC;
+
+/* descriptors that are built on-demand */
+static char manufacturer [50];
+static char product_desc [40] = COMPOSITE_DESC;
+static char serial_number [20] = {0};
+
+/*-*/
+
+#define NUM_CONFIGS1
+
+#define VENDOR_ID  0x0525 /* NetChip */
+#define PRODUCT_ID 0Xa4a6 /* Linux-USB Serial */
+#define COMPOSITE_CONFIG_NUMBER1
+
+/* USB String IDs */
+#define COMPOSITE_MANUFACTURER_ID  1
+#define COMPOSITE_PRODUCT_ID   2
+#define COMPOSITE_SERIALNUMBER_ID  3
+#define COMPOSITE_CONFIG_SRT_ID4
+
+MODULE_DESCRIPTION(COMPOSITE_DESC);
+MODULE_AUTHOR(Felipe Balbi, Ragner Magalhaes);
+MODULE_LICENSE(GPL);
+
+/* USB Strings, UTF8 */
+
+
+static struct usb_string composite_strings[] = {
+   { COMPOSITE_MANUFACTURER_ID, manufacturer },
+   { COMPOSITE_PRODUCT_ID, product_desc},
+   { COMPOSITE_SERIALNUMBER_ID, serial_number },
+   { COMPOSITE_CONFIG_SRT_ID, Composite Alpha },
+   {  } /* end */
+};
+static struct usb_gadget_strings composite_stringtable = {
+   .language   = 0x0409, /* en-US */
+   .strings= composite_strings,
+};
+static struct usb_device_descriptor composite_device_desc = {
+   .bLength= USB_DT_DEVICE_SIZE,
+   .bDescriptorType= USB_DT_DEVICE,
+   .bcdUSB = __constant_cpu_to_le16(0x0200),
+   .bDeviceClass   = USB_CLASS_PER_INTERFACE,
+   .bDeviceSubClass= USB_CLASS_PER_INTERFACE,
+   .bDeviceProtocol= 0,
+   .idVendor   = __constant_cpu_to_le16(VENDOR_ID),
+   .idProduct  = __constant_cpu_to_le16(PRODUCT_ID),
+   .iManufacturer  = COMPOSITE_MANUFACTURER_ID,
+   .iProduct   = COMPOSITE_PRODUCT_ID,
+   .iSerialNumber  = COMPOSITE_SERIALNUMBER_ID,
+   .bNumConfigurations = NUM_CONFIGS,
+};
+static struct usb_config_descriptor composite_config_desc = {
+   .bLength= USB_DT_CONFIG_SIZE,
+   .bDescriptorType= USB_DT_CONFIG,
+   /* wTotalLenght computed dynamically */
+   .bNumInterfaces = MAX_COMPOSITE_INTERFACES,
+   .bConfigurationValue= COMPOSITE_CONFIG_NUMBER,
+   .iConfiguration = COMPOSITE_CONFIG_SRT_ID,
+   .bmAttributes   = USB_CONFIG_ATT_ONE | USB_CONFIG_ATT_SELFPOWER,
+   .bMaxPower  = 1,
+};
+static struct usb_qualifier_descriptor composite_qualifier_desc = {
+   .bLength =  sizeof composite_qualifier_desc,
+   .bDescriptorType= USB_DT_DEVICE_QUALIFIER,
+   .bcdUSB = __constant_cpu_to_le16(0x0200),
+   .bDeviceClass   = USB_CLASS_PER_INTERFACE,
+   .bNumConfigurations = NUM_CONFIGS,
+};
+
+struct usb_composite_dev*cdev;
+
+/* Functions */
+
+/* module */
+static int __init composite_init(void);
+static void __exit composite_exit(void);
+
+/* usb_function register function */
+int usb_function_register(struct usb_function *);
+
+static int composite_func_bind(struct usb_composite_dev *composite_dev)
+{
+   struct usb_gadget *gadget = composite_dev-gadget;
+   cdev

[linux-usb-devel] [patch 5/8] Serial Gadget Suppor

2007-03-19 Thread Felipe Balbi
This patch adds some ifdefs to make the serial gadget work
as a usb_function module.

Signed-off-by: Felipe Balbi [EMAIL PROTECTED]
Signed-off-by: Ragner Magalhes [EMAIL PROTECTED]
---

Index: linux-2.6/drivers/usb/gadget/serial.c
===
--- linux-2.6.orig/drivers/usb/gadget/serial.c
+++ linux-2.6/drivers/usb/gadget/serial.c
@@ -47,2 +47,3 @@
 #include linux/usb_gadget.h
+#include linux/usb/composite.h
 
@@ -220,3 +221,2 @@ static int gs_setup_class(struct usb_gad
const struct usb_ctrlrequest *ctrl);
-static void gs_setup_complete(struct usb_ep *ep, struct usb_request *req);
 static void gs_disconnect(struct usb_gadget *gadget);
@@ -224,4 +224,7 @@ static int gs_set_config(struct gs_dev *
 static void gs_reset_config(struct gs_dev *dev);
+#ifndef USB_COMPOSITE_DEVICE
+static void gs_setup_complete(struct usb_ep *ep, struct usb_request *req);
 static int gs_build_config_buf(u8 *buf, enum usb_device_speed speed,
u8 type, unsigned int index, int is_otg);
+#endif /* !USB_COMPOSITE_DEVICE */
 
@@ -287,3 +290,15 @@ static const struct tty_operations gs_tt
 static struct tty_driver *gs_tty_driver;
+static struct usb_gadget_strings gs_string_table;
 
+#ifdef USB_COMPOSITE_DEVICE
+/* USB_FUNCTION */
+struct usb_function gs_usb_function = {
+   .name   = GS_LONG_NAME,
+   .strings= gs_string_table,
+   .bind   = gs_bind,
+   .unbind = gs_unbind,
+   .setup  = gs_setup,
+   .disconnect = gs_disconnect,
+};
+#else
 /* gadget driver struct */
@@ -304,2 +319,3 @@ static struct usb_gadget_driver gs_gadge
 };
+#endif /* USB_COMPOSITE_DEVICE */
 
@@ -308,2 +324,6 @@ static struct usb_gadget_driver gs_gadge
 
+#ifdef USB_COMPOSITE_DEVICE
+#define GS_CONTROL_STR_ID  1
+#define GS_DATA_STR_ID 2
+#else
 #define GS_MANUFACTURER_STR_ID 1
@@ -315,2 +335,3 @@ static struct usb_gadget_driver gs_gadge
 #define GS_DATA_STR_ID 7
+#endif /* USB_COMPOSITE_DEVICE */
 
@@ -318,3 +339,8 @@ static struct usb_gadget_driver gs_gadge
 static char manufacturer[50];
+
 static struct usb_string gs_strings[] = {
+#ifdef USB_COMPOSITE_DEVICE
+   { GS_CONTROL_STR_ID, Serial Control },
+   { GS_DATA_STR_ID, Serial Data },
+#else
{ GS_MANUFACTURER_STR_ID, manufacturer },
@@ -326,2 +352,3 @@ static struct usb_string gs_strings[] = 
{ GS_DATA_STR_ID, Gadget Serial Data },
+#endif /* USB_COMPOSITE_DEVICE */
{  } /* end of list */
@@ -333,3 +360,6 @@ static struct usb_gadget_strings gs_stri
 };
-
+#ifndef USB_COMPOSITE_DEVICE
+/* if defined composite, use the device descriptor
+ * from composite for all gadgets.
+ */
 static struct usb_device_descriptor gs_device_desc = {
@@ -347,2 +377,3 @@ static struct usb_device_descriptor gs_d
 };
+#endif /* !USB_COMPOSITE_DEVICE */
 
@@ -354,2 +385,6 @@ static struct usb_otg_descriptor gs_otg_
 
+#ifndef USB_COMPOSITE_DEVICE
+/* if defined composite, use the config descriptor
+ * from composite for all gadgets.
+ */
 static struct usb_config_descriptor gs_bulk_config_desc = {
@@ -375,4 +410,5 @@ static struct usb_config_descriptor gs_a
 };
+#endif /* !USB_COMPOSITE_DEVICE */
 
-static const struct usb_interface_descriptor gs_bulk_interface_desc = {
+struct usb_interface_descriptor gs_bulk_interface_desc = {
.bLength =  USB_DT_INTERFACE_SIZE,
@@ -387,3 +423,3 @@ static const struct usb_interface_descri
 
-static const struct usb_interface_descriptor gs_control_interface_desc = {
+struct usb_interface_descriptor gs_control_interface_desc = {
.bLength =  USB_DT_INTERFACE_SIZE,
@@ -398,3 +434,3 @@ static const struct usb_interface_descri
 
-static const struct usb_interface_descriptor gs_data_interface_desc = {
+struct usb_interface_descriptor gs_data_interface_desc = {
.bLength =  USB_DT_INTERFACE_SIZE,
@@ -431,3 +467,3 @@ static struct usb_cdc_acm_descriptor gs_
 
-static const struct usb_cdc_union_desc gs_union_desc = {
+static struct usb_cdc_union_desc gs_union_desc = {
.bLength =  sizeof(gs_union_desc),
@@ -462,3 +498,3 @@ static struct usb_endpoint_descriptor gs
 
-static const struct usb_descriptor_header *gs_bulk_fullspeed_function[] = {
+static struct usb_descriptor_header *gs_bulk_fullspeed_function[] = {
(struct usb_descriptor_header *) gs_otg_descriptor,
@@ -470,3 +506,3 @@ static const struct usb_descriptor_heade
 
-static const struct usb_descriptor_header *gs_acm_fullspeed_function[] = {
+struct usb_descriptor_header *gs_acm_fullspeed_function[] = {
(struct usb_descriptor_header *) gs_otg_descriptor,
@@ -508,2 +544,3 @@ static struct usb_endpoint_descriptor gs
 
+#ifndef USB_COMPOSITE_DEVICE
 static struct usb_qualifier_descriptor gs_qualifier_desc = {
@@ -515,4 +552,5 @@ static struct usb_qualifier_descriptor g
 };
+#endif /* !USB_COMPOSITE_DEVICE */
 
-static const struct

[linux-usb-devel] [patch 6/8] Ether Gadget Support

2007-03-19 Thread Felipe Balbi
This patch adds some ifdefs to make the ether gadget work
as a usb_function module.

Signed-off-by: Felipe Balbi [EMAIL PROTECTED]
Signed-off-by: Ragner Magalhes [EMAIL PROTECTED]
---
Index: linux-2.6/drivers/usb/gadget/ether.c
===
--- linux-2.6.orig/drivers/usb/gadget/ether.c
+++ linux-2.6/drivers/usb/gadget/ether.c
@@ -51,2 +51,3 @@
 #include linux/usb_gadget.h
+#include linux/usb/composite.h
 
@@ -414,2 +415,8 @@ static inline int BITRATE(struct usb_gad
 
+#ifdef USB_COMPOSITE_DEVICE
+#define STRING_DATA1
+#define STRING_ETHADDR 2
+#define STRING_CONTROL 3
+#define STRING_RNDIS_CONTROL   4
+#else
 #define STRING_MANUFACTURER1
@@ -424,2 +431,3 @@ static inline int BITRATE(struct usb_gad
 #define STRING_SERIALNUMBER10
+#endif /* USB_COMPOSITE_DEVICE */
 
@@ -442,2 +450,4 @@ static inline int BITRATE(struct usb_gad
 
+#ifndef USB_COMPOSITE_DEVICE
+/* if defined composite, get the device descriptor from composite */
 static struct usb_device_descriptor
@@ -459,2 +469,3 @@ device_desc = {
 };
+#endif /* !USB_COMPOSITE_DEVICE */
 
@@ -468,2 +479,4 @@ otg_descriptor = {
 
+#ifndef USB_COMPOSITE_DEVICE
+/* if defined composite get the config descriptor from composite */
 static struct usb_config_descriptor
@@ -495,2 +508,4 @@ rndis_config = {
 #endif
+#endif /* !USB_COMPOSITE_DEVICE */
+
 
@@ -532,3 +547,3 @@ control_intf = {
 #ifdef CONFIG_USB_ETH_RNDIS
-static const struct usb_interface_descriptor
+static struct usb_interface_descriptor
 rndis_control_intf = {
@@ -556,3 +571,3 @@ static const struct usb_cdc_header_desc 
 
-static const struct usb_cdc_union_desc union_desc = {
+static struct usb_cdc_union_desc union_desc = {
.bLength =  sizeof union_desc,
@@ -672,3 +687,3 @@ fs_status_desc = {
 
-static const struct usb_interface_descriptor
+static struct usb_interface_descriptor
 data_nop_intf = {
@@ -683,2 +698,3 @@ data_nop_intf = {
.bInterfaceProtocol =   0,
+   .iInterface =   STRING_DATA,
 };
@@ -687,3 +703,3 @@ data_nop_intf = {
 
-static const struct usb_interface_descriptor
+static struct usb_interface_descriptor
 data_intf = {
@@ -707,3 +723,3 @@ data_intf = {
 
-static const struct usb_interface_descriptor
+static struct usb_interface_descriptor
 rndis_data_intf = {
@@ -733,3 +749,3 @@ rndis_data_intf = {
 
-static const struct usb_interface_descriptor
+static struct usb_interface_descriptor
 subset_data_intf = {
@@ -768,3 +784,3 @@ fs_sink_desc = {
 
-static const struct usb_descriptor_header *fs_eth_function [11] = {
+static struct usb_descriptor_header *fs_eth_function [11] = {
(struct usb_descriptor_header *) otg_descriptor,
@@ -805,3 +821,3 @@ static inline void __init fs_subset_desc
 #ifdef CONFIG_USB_ETH_RNDIS
-static const struct usb_descriptor_header *fs_rndis_function [] = {
+static struct usb_descriptor_header *fs_rndis_function [] = {
(struct usb_descriptor_header *) otg_descriptor,
@@ -859,2 +875,3 @@ hs_sink_desc = {
 
+#ifndef USB_COMPOSITE_DEVICE
 static struct usb_qualifier_descriptor
@@ -869,4 +886,5 @@ dev_qualifier = {
 };
+#endif /* !USB_COMPOSITE_DEVICE */
 
-static const struct usb_descriptor_header *hs_eth_function [11] = {
+static struct usb_descriptor_header *hs_eth_function [11] = {
(struct usb_descriptor_header *) otg_descriptor,
@@ -944,4 +962,6 @@ static inline void __init hs_subset_desc
 static charmanufacturer [50];
+#ifndef USB_COMPOSITE_DEVICE
 static charproduct_desc [40] = DRIVER_DESC;
 static charserial_number [20];
+#endif /* !USB_COMPOSITE_DEVICE */
 
@@ -952,2 +972,13 @@ static charethaddr [2 * 
ETH_ALEN + 1
 static struct usb_string   strings [] = {
+   /* ifdef composite */
+#ifdef USB_COMPOSITE_DEVICE
+   { STRING_DATA,  Ethernet Data, },
+#ifdef DEV_CONFIG_CDC
+   { STRING_ETHADDR,   ethaddr, },
+   { STRING_CONTROL,   CDC Communications Control, },
+#endif
+#ifdef CONFIG_USB_ETH_RNDIS
+   { STRING_RNDIS_CONTROL, RNDIS Communications Control, },
+#endif
+#else /* USB_COMPOSITE_DEVICE */
{ STRING_MANUFACTURER,  manufacturer, },
@@ -968,2 +999,3 @@ static struct usb_stringstrings [] = {
 #endif
+#endif /* USB_COMPOSITE_DEVICE */
{  }/* end of list */
@@ -976,2 +1008,7 @@ static struct usb_gadget_strings   stringt
 
+#ifdef USB_COMPOSITE_DEVICE
+static struct usb_function eth_usb_function;
+#endif
+
+#ifndef USB_COMPOSITE_DEVICE
 /*
@@ -987,3 +1024,3 @@ config_buf (enum usb_device_speed speed,
const struct usb_config_descriptor  *config;
-   const struct usb_descriptor_header  **function;
+   struct usb_descriptor_header**function;
 #ifdef CONFIG_USB_GADGET_DUALSPEED
@@ -1025,2 +1062,3 @@ config_buf

[linux-usb-devel] [patch 8/8] Omap_udc Modification

2007-03-19 Thread Felipe Balbi
This patch adds some endpoints into omap_udc fifo_mode
for the three already modified gadget to work together

Signed-off-by: Felipe Balbi [EMAIL PROTECTED]
Signed-off-by: Ragner Magalhes [EMAIL PROTECTED]
---

Index: linux-2.6/drivers/usb/gadget/omap_udc.c
===
--- linux-2.6.orig/drivers/usb/gadget/omap_udc.c
+++ linux-2.6/drivers/usb/gadget/omap_udc.c
@@ -2760,5 +2760,9 @@ omap_udc_setup(struct platform_device *o
 
-   OMAP_ISO_EP(ep7in,   USB_DIR_IN  | 7, 256);
-   OMAP_ISO_EP(ep8out,  USB_DIR_OUT | 8, 256);
-   OMAP_INT_EP(ep9in,   USB_DIR_IN  | 9, 16);
+   OMAP_BULK_EP(ep7in,   USB_DIR_IN  | 7);
+   OMAP_BULK_EP(ep8out,  USB_DIR_OUT | 8);
+   OMAP_INT_EP(ep9in,USB_DIR_IN  | 9, 16);
+
+   OMAP_ISO_EP(ep10in,   USB_DIR_IN  | 10, 256);
+   OMAP_ISO_EP(ep11out,  USB_DIR_OUT | 11, 256);
+   OMAP_INT_EP(ep12in,   USB_DIR_IN  | 12, 16);
break;

--
Best Regards,

Felipe Balbi
[EMAIL PROTECTED]

Nokia Institute of Technology - INdT
Kernel Developers Team

+55 92 2126 1003


-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] Fwd: [RFC] g_serial: Real tty device passthrough.

2007-03-09 Thread Felipe Balbi
-- Forwarded message --
From: Felipe Balbi [EMAIL PROTECTED]
Date: Mar 9, 2007 2:19 PM
Subject: Re: [linux-usb-devel] [RFC] g_serial: Real tty device passthrough.
To: Stefan Schmidt [EMAIL PROTECTED]


On 3/8/07, Stefan Schmidt [EMAIL PROTECTED] wrote:
 Hello.

 We have a linux smartphone here with the GSM modem on /dev/ttySAC0 .
 As now like to make this tty available to the host through g_serial.
 This allows us faster development and testing.
Ok, this can be done but g_serial was developed to use Major number
127... I don't know that you could just pass another device to the
module... you should write some glue module between g_serial and your
GSM module. And maybe you should modify g_serial a little bit for
this to work fine.

If you could show us some of the code that creates the /dev/ttySAC0
maybe we could point you something.

Which smartphone are you using? Which model? Manufacturer? Which
linux-kernel? etc...


 The first idea we had was to splice /dev/ttygs* and /dev/ttySAC0
 together in phone userspace. But how can we handle things like
 baudrate change on the host, etc. The passthrough should be as
 transparent as possible.

 We now think about a solution like the ine used in file_storage.c .

 Let the g_serial driver directly communicate with the device. Loading
 the driver with something like

 modprobe g_serial device=ttySAC0
This you should implement... g_serial doesn't yet have a way for
Major/Minor number changing...



 should route the whole communication to /dev/ttySAC0 instead of
 /dev/ttygs* .

 Anybody already worked on something like this?

I don't have any smartphone to test... but we can chat about it...



--
Best Regards,

Felipe Balbi
[EMAIL PROTECTED]


-- 
Best Regards,

Felipe Balbi
[EMAIL PROTECTED]

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


Re: [linux-usb-devel] [RFC] g_serial: Real tty device passthrough.

2007-03-09 Thread Felipe Balbi
Hello Again Stefan

On 3/9/07, Stefan Schmidt [EMAIL PROTECTED] wrote:
 [added cc's again]

 Hello.

 On Fri, 2007-03-09 at 14:19, Felipe Balbi wrote:
  On 3/8/07, Stefan Schmidt [EMAIL PROTECTED] wrote:
  
  We have a linux smartphone here with the GSM modem on /dev/ttySAC0 .
  As now like to make this tty available to the host through g_serial.
  This allows us faster development and testing.
  Ok, this can be done but g_serial was developed to use Major number
  127... I don't know that you could just pass another device to the
  module

 You can't. That was just the idea. Sorry for confusing you.

Don't worry :-D
We're now getting there

  you should write some glue module between g_serial and your
  GSM module. And maybe you should modify g_serial a little bit for
  this to work fine.

 I had two points asking here for suggestion:

 1. Ask if code for something like this exists that we can use instead
reinvent the wheel.

I don't think that we already have this implemented. So, this one is discarded.


 2. Ask about opinions and suggestions for doing this in an elegant
way. We don't like to write throw-away code. It should go into
mainline and also be used for other projects.

 Just to get it right. You suggest to extend g_serial for communication
 with another driver and write some glue which communicates with
 g_serial on the one and ttySAC0 on the other side?

 I could life with that solution, but why not extend g_serial with a
 paramter to communicate directly with another tty?

Yep... this could be done... actually it's not that difficult, check
the code here:

#define GS_MAJOR127
#define GS_MINOR_START0

I think the first test here is to change this two defines for you
MAJOR and MINOR numbers, the ones for /dev/ttySACx


After that, if this is working... you could:
module_param(major, int, S_IRUGO|S_IWUSR);
MODULE_PARM_DESC(major, Sets the Major Number for the tty port);

module_param(minor, int, S_IRUGO|S_IWUSR);
MODULE_PARM_DESC(minor, Sets the Minor Number for the tty port);


And then you test it again.
Maybe you'll need some other work for this to work fine... I'll be
reading Samsung's s3c2410 serial code to check how to connect them...

Also, I'll try to take a look at the openmoko project and see what are
you guys  doing...

Please let me know if this is working or not...


  If you could show us some of the code that creates the /dev/ttySAC0
  maybe we could point you something.

 It's the standard tty driver for this SoC (s3c2410). The GSM part of
 the phone is connected to the main CPU through a standard serial
 connection on the PCB. Nothing fancy.

If it's a standard TTY protocol I'm pretty sure the above suggestions
will work... :-)
I think g_serial is not Ok with standard tty terminals... it's more
reliable with ACM terminals... so maybe you should check this too...

Please, again, let me know about your test results :-)


  Which smartphone are you using? Which model? Manufacturer? Which
  linux-kernel? etc...

 It's the Neo1973 smartphone. First device using the OpenMoko open
 source mobile stack. http://openmoko.org/

 Atm we are running 2.6.20.1 and tracking newer versions. Harald Welte
 is already working with Ben Dooks to get some patches for the samasung
 SoC upstream. Other will follow once they are stable and we cleaned
 them up. You can track them here: (euilt patchset in svn)

 https://svn.openmoko.org/trunk/src/target/kernel/patches/

I'm checking the above URLS


  modprobe g_serial device=ttySAC0
  This you should implement... g_serial doesn't yet have a way for
  Major/Minor number changing...

 Yeah, that was the idea. Main question was how to do this in an
 elegant way.
Once you set-up the major and minor parameters (and variables) you
should change the entire GS_MAJOR and GS_MINOR_START calling to use
the new variables...

Let us know about it :-D

-- 
Best Regards,

Felipe Balbi
[EMAIL PROTECTED]

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


Re: [linux-usb-devel] [RFC] [PATCH 0/5]: Composite Devices Support

2007-02-22 Thread Felipe Balbi
On Thu, 2007-02-22 at 10:37 -0500, ext Alan Stern wrote:
 On Thu, 22 Feb 2007, Felipe Balbi wrote:
 
  When I wrote attributions I meant:
  struct usb_gadget *gadget = cdev-current_func-gadget;
  
  This I already turned up into:
  struct usb_gadget *gadget = get_composite_gadget(cdev);
  
  And other instructions like this one...
 
 The one thing I didn't like about your changes was all the #ifdef lines 
 added to the function definitions.  Perhaps you can come up with some 
 typedefs and inline routines (whose definitions would depend on whether or 
 not the composite-gadget option was enabled) to make the code look simple 
 again.
Actually I was thinking about porting the g_ module into function
drivers for good.

I'm wondering if a composite device with only one function would become
a simple gadget anyway...

But the typedefs and inline functions are good too... Thanks Alan

 
 Alan Stern
 
-- 
Best Regards,

Felipe Balbi
[EMAIL PROTECTED]

Nokia Institute of Technology - INdT
Kernel Developers Team

+55 92 2126 1003


-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] [RFC] [PATCH 0/5]: Composite Devices Support

2007-02-02 Thread Felipe Balbi
The following patch series add support for Composite Devices following
what was proposed David Brownell's patch.

Each patch modify one g_* module (ether, file_storage, serial) and
another one sets up the base for such support.

We have some known issues but the code is working pretty fine with
omap_h3 and omap_h2 development boards.

We still have some work to do but this is our approach for USB Composite
Gadgets support. If you could please comment the idea, we would be able
to refine the code.

Listed below are the know issues:

- How to get which are the implemented bRequestTypes, as 
  defined on linux as the USB_TYPE_ macros, from the gadget 
  drivers?

- Some of the direct attributions will be turned up into proper
  functions.

- One of the patches modify omap_udc.c to add 3 more endpoints
  for us to be able to test composite framework running with 
  all of the g_* gadget drivers.

- A composite Gadget with only one function, wouldn't it become
  a simple gadget? If this is true, wouldn't be better to modify
  USB Gadget Framework to become USB Gadget/Composite Framework
  and get rid of those #if defined's?

- omap_udc.c defines some fifo_modes. The way it is implemented
  composite framework would be limited to the fifo_modes
  omap_udc.c implements, I mean that whenever I add a new
  gadget driver, we would need to implement another fifo_mode
  to handle the endpoints. Wouldn't be nice to make the
  fifo_modes more dynamic ??

-- 
Best Regards,

Felipe Balbi
[EMAIL PROTECTED]

Nokia Institute of Technology - INdT
Kernel Developers Team

+55 92 2126 1003


-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] [RFC] [PATCH 1/5]: Composite Devices Support

2007-02-02 Thread Felipe Balbi
  next_string_id;
+   u8  next_interface_id;
+   struct usb_function *current_bind;
+   struct usb_function *interface[MAX_COMPOSITE_INTERFACES];
+
+   struct usb_composite_driver *driver;
+   struct usb_qualifier_descriptor qual;
+};
+
+/* IDs may be assigned ONLY during function driver bind() */
+extern int usb_composite_string_id(struct usb_composite_dev *c);
+extern int usb_composite_interface_id(struct usb_composite_dev *c);
+
+#endif  /* __KERNEL__ */
+
+#endif /* __LINUX_USB_COMPOSITE_H */
Index: 2.6-dev/include/linux/usb_gadget.h
===
--- 2.6-dev.orig/include/linux/usb_gadget.h 2007-01-29
11:37:52.0 -0400
+++ 2.6-dev/include/linux/usb_gadget.h  2007-01-29 11:57:48.0
-0400
@@ -853,7 +853,7 @@
 };
 
 /* put descriptor for string with that id into buf (buflen = 256) */
-int usb_gadget_get_string (struct usb_gadget_strings *table, int id, u8
*buf);
+int usb_gadget_get_string(const struct usb_gadget_strings *table, int
id, u8 *buf);
 
 /*-*/
 

-- 
Best Regards,

Felipe Balbi
[EMAIL PROTECTED]

Nokia Institute of Technology - INdT
Kernel Developers Team

+55 92 2126 1003


-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] [RFC] [PATCH 2/5]: Composite Devices Support

2007-02-02 Thread Felipe Balbi
[PATCH] Base work for composite gadget support.

Signed-off-by: Felipe Balbi [EMAIL PROTECTED]
Signed-off-by: Ragner Magalhaes [EMAIL PROTECTED]
---

Index: 2.6-dev/drivers/usb/gadget/Kconfig
===
--- 2.6-dev.orig/drivers/usb/gadget/Kconfig 2007-01-29
11:40:21.0 -0400
+++ 2.6-dev/drivers/usb/gadget/Kconfig  2007-01-29 11:42:00.0
-0400
@@ -282,6 +282,15 @@
 
 # this first set of drivers all depend on bulk-capable hardware.
 
+config USB_COMPOSITE
+   tristate Composite Gadget Support
+   depends on USB_GADGET
+   help
+  A composite gadget is a device with more than one
+  interface.
+
+  This module adds support for this kind of device.
+
 config USB_ZERO
tristate Gadget Zero (DEVELOPMENT)
depends on EXPERIMENTAL
Index: 2.6-dev/drivers/usb/gadget/Makefile
===
--- 2.6-dev.orig/drivers/usb/gadget/Makefile2007-01-29
11:40:21.0 -0400
+++ 2.6-dev/drivers/usb/gadget/Makefile 2007-01-29 11:42:18.0
-0400
@@ -19,6 +19,8 @@
 gadgetfs-objs  := inode.o
 g_file_storage-objs:= file_storage.o usbstring.o config.o \
epautoconf.o
+g_composite-objs   := composite_functions.o composite.o \
+   usbstring.o config.o epautoconf.o
 
 ifeq ($(CONFIG_USB_ETH_RNDIS),y)
g_ether-objs+= rndis.o
@@ -30,4 +32,4 @@
 obj-$(CONFIG_USB_FILE_STORAGE) += g_file_storage.o
 obj-$(CONFIG_USB_G_SERIAL) += g_serial.o
 obj-$(CONFIG_USB_MIDI_GADGET)  += g_midi.o
-
+obj-$(CONFIG_USB_COMPOSITE)+= g_composite.o
Index: 2.6-dev/drivers/usb/gadget/composite.c
===
--- 2.6-dev.orig/drivers/usb/gadget/composite.c 2007-01-29
11:39:35.0 -0400
+++ 2.6-dev/drivers/usb/gadget/composite.c  2007-01-29 11:42:29.0
-0400
@@ -1,6 +1,3 @@
-#define DEBUG 1
-// #define VERBOSE
-
 #include linux/module.h
 #include linux/kernel.h
 #include linux/delay.h
@@ -22,9 +19,12 @@
 #include asm/unaligned.h
 
 #include linux/usb_ch9.h
+#include linux/usb/cdc.h
 #include linux/usb_gadget.h
 #include linux/usb/composite.h
 
+#define DEBUG 1
+#define VERBOSE 1
 
 #define xprintk(d,level,fmt,args...) \
dev_printk(level , (d)-gadget-dev , fmt , ## args)
@@ -51,10 +51,22 @@
 #define INFO(dev,fmt,args...) \
xprintk(dev , KERN_INFO , fmt , ## args)
 
+/* Defines */
+#define DRIVER_DESCComposite Device
+#define DRIVER_VERSION v1.0-alfa
+#define DRIVER_NAMEcomposite
+
+static const char driver_desc [] = DRIVER_DESC;
+static const char shortname [] = DRIVER_NAME;
+
 /*-*/
 
+#define NUM_CONFIGS1
+#define COMPOSITE_CONFIG_VALUE  3  /* composite config */
+
 /* big enough to hold our biggest descriptor */
-#define USB_BUFSIZ 512
+#define USB_BUFSIZ 256
+
 
 
 static struct usb_composite_driver *composite;
@@ -78,6 +90,7 @@
 }
 
 /*-*/
+/*-*/
 
 /* To simplify, we expect to have only ONE real configuration, working
the
  * same no matter what speed it connects with.  A given function may
expose
@@ -85,7 +98,7 @@
  * class and endpoint descriptors (as usual).
  */
 
-#defineCONFIG_NUMBER   1
+#define COMPOSITE_CONFIG_NUMBER1
 
 static int
 config_buf(struct usb_composite_dev *cdev, void *buf, u8 type)
@@ -103,11 +116,12 @@
} else
hs = 0;
 
+
/* write a config descriptor */
*c = cdev-config;
c-bLength = USB_DT_CONFIG_SIZE;
c-bDescriptorType = type;
-   c-bConfigurationValue = CONFIG_NUMBER;
+   c-bConfigurationValue = COMPOSITE_CONFIG_NUMBER;
 
/* REVISIT some configurations might need other descriptors,
 * independent of the interfaces they implement ... notably
@@ -139,13 +153,14 @@
 ) {
struct usb_function *f;
int result;
-
DBG(cdev, reset config\n);
 
req-bRequestType = USB_DIR_OUT | USB_TYPE_STANDARD |
USB_RECIP_DEVICE;
req-bRequest = USB_REQ_SET_CONFIGURATION;
+   req-wValue = COMPOSITE_CONFIG_VALUE;
 
list_for_each_entry (f, composite-functions, function) {
+  cdev-current_func = f;
result = f-setup(cdev, req);
if (result  0)
DBG(cdev, reset function %s -- %d\n,
@@ -157,7 +172,7 @@
 static int
 composite_set_config(struct usb_composite_dev *cdev, unsigned number)
 {
-   int result = 0, tmp;
+   int result = 0;
struct usb_gadget   *gadget = cdev

[linux-usb-devel] [RFC] [PATCH 3/5]: Composite Devices Support

2007-02-02 Thread Felipe Balbi
[PATCH] g_ether modification for it to become a USB_FUNCTION.

Signed-off-by: Felipe Balbi [EMAIL PROTECTED]
Signed-off-by: Ragner Magalhaes [EMAIL PROTECTED]
---

Index: 2.6-dev/drivers/usb/gadget/ether.c
===
--- 2.6-dev.orig/drivers/usb/gadget/ether.c 2007-01-29
11:45:37.0 -0400
+++ 2.6-dev/drivers/usb/gadget/ether.c  2007-01-29 11:46:00.0
-0400
@@ -20,8 +20,8 @@
  */
 
 
-// #define DEBUG 1
-// #define VERBOSE
+#define DEBUG 1
+#define VERBOSE 1
 
 #include linux/module.h
 #include linux/kernel.h
@@ -50,6 +50,7 @@
 #include linux/usb_ch9.h
 #include linux/usb/cdc.h
 #include linux/usb_gadget.h
+#include linux/usb/composite.h
 
 #include linux/random.h
 #include linux/netdevice.h
@@ -398,7 +399,19 @@
  * Ethernet functionality), they don't need the NOP altsetting, and the
  * status transfer endpoint isn't optional.
  */
-
+#ifdefined(CONFIG_USB_COMPOSITE) ||
defined(CONFIG_USB_COMPOSITE_MODULE)
+/* eth[11-20], serial[21-27], storage[31-35] */
+#define STRING_MANUFACTURER11
+#define STRING_PRODUCT 12
+#define STRING_ETHADDR 13
+#define STRING_DATA14
+#define STRING_CONTROL 15
+#define STRING_RNDIS_CONTROL   16
+#define STRING_CDC 17
+#define STRING_SUBSET  18
+#define STRING_RNDIS   19
+#define STRING_SERIALNUMBER20
+#else
 #define STRING_MANUFACTURER1
 #define STRING_PRODUCT 2
 #define STRING_ETHADDR 3
@@ -409,6 +422,7 @@
 #define STRING_SUBSET  8
 #define STRING_RNDIS   9
 #define STRING_SERIALNUMBER10
+#endif /* End if Composite*/
 
 /* holds our biggest descriptor (or RNDIS response) */
 #define USB_BUFSIZ 256
@@ -423,8 +437,12 @@
  * FIXME define some higher-powered configurations to make it easier
  * to recharge batteries ...
  */
-
+#ifdefined(CONFIG_USB_COMPOSITE) ||
defined(CONFIG_USB_COMPOSITE_MODULE)
+#define COMPOSITE_CONFIG_VALUE  3  /* composite config */
+#define DEV_CONFIG_VALUE   COMPOSITE_CONFIG_VALUE
+#else
 #define DEV_CONFIG_VALUE   1   /* cdc or subset */
+#endif
 #define DEV_RNDIS_CONFIG_VALUE 2   /* rndis; optional */
 
 static struct usb_device_descriptor
@@ -492,7 +510,7 @@
  */
 
 #ifdef DEV_CONFIG_CDC
-static struct usb_interface_descriptor
+struct usb_interface_descriptor
 control_intf = {
.bLength =  sizeof control_intf,
.bDescriptorType =  USB_DT_INTERFACE,
@@ -508,7 +526,7 @@
 #endif
 
 #ifdef CONFIG_USB_ETH_RNDIS
-static const struct usb_interface_descriptor
+struct usb_interface_descriptor
 rndis_control_intf = {
.bLength =  sizeof rndis_control_intf,
.bDescriptorType =  USB_DT_INTERFACE,
@@ -532,7 +550,7 @@
.bcdCDC =   __constant_cpu_to_le16 (0x0110),
 };
 
-static const struct usb_cdc_union_desc union_desc = {
+static struct usb_cdc_union_desc union_desc = {
.bLength =  sizeof union_desc,
.bDescriptorType =  USB_DT_CS_INTERFACE,
.bDescriptorSubType =   USB_CDC_UNION_TYPE,
@@ -616,7 +634,7 @@
 
 /* the default data interface has no endpoints ... */
 
-static const struct usb_interface_descriptor
+struct usb_interface_descriptor
 data_nop_intf = {
.bLength =  sizeof data_nop_intf,
.bDescriptorType =  USB_DT_INTERFACE,
@@ -631,7 +649,7 @@
 
 /* ... but the real data interface has two bulk endpoints */
 
-static const struct usb_interface_descriptor
+struct usb_interface_descriptor
 data_intf = {
.bLength =  sizeof data_intf,
.bDescriptorType =  USB_DT_INTERFACE,
@@ -651,7 +669,7 @@
 
 /* RNDIS doesn't activate by changing to the real altsetting */
 
-static const struct usb_interface_descriptor
+struct usb_interface_descriptor
 rndis_data_intf = {
.bLength =  sizeof rndis_data_intf,
.bDescriptorType =  USB_DT_INTERFACE,
@@ -674,7 +692,7 @@
  * full speed controllers can handle:  one interface, two bulk
endpoints.
  */
 
-static const struct usb_interface_descriptor
+struct usb_interface_descriptor
 subset_data_intf = {
.bLength =  sizeof subset_data_intf,
.bDescriptorType =  USB_DT_INTERFACE,
@@ -709,7 +727,7 @@
.bmAttributes = USB_ENDPOINT_XFER_BULK,
 };
 
-static const struct usb_descriptor_header *fs_eth_function [11] = {
+static struct usb_descriptor_header *fs_eth_function [11] = {
(struct usb_descriptor_header *) otg_descriptor,
 #ifdef DEV_CONFIG_CDC
/* cdc mode descriptors */
@@ -806,7 +824,7 @@
.bNumConfigurations =   1,
 };
 
-static const struct usb_descriptor_header *hs_eth_function [11] = {
+static struct usb_descriptor_header *hs_eth_function [11] = {
(struct usb_descriptor_header *) otg_descriptor,
 #ifdef

[linux-usb-devel] [RFC] [PATCH 5/5]: Composite Devices Support

2007-02-02 Thread Felipe Balbi
[PATCH] g_serial modification for it to become a USB_FUNCTION.

Signed-off-by: Felipe Balbi [EMAIL PROTECTED]
Signed-off-by: Ragner Magalhaes [EMAIL PROTECTED]
---

Index: 2.6-dev/drivers/usb/gadget/serial.c
===
--- 2.6-dev.orig/drivers/usb/gadget/serial.c2007-01-29
11:44:59.0 -0400
+++ 2.6-dev/drivers/usb/gadget/serial.c 2007-01-29 11:45:11.0
-0400
@@ -45,6 +45,7 @@
 
 #include linux/usb_ch9.h
 #include linux/usb/cdc.h
+#include linux/usb/composite.h
 #include linux/usb_gadget.h
 
 #include gadget_chips.h
@@ -66,7 +67,12 @@
 #define GS_NUM_CONFIGS 1
 #define GS_NO_CONFIG_ID0
 #define GS_BULK_CONFIG_ID  1
+#ifdefined(CONFIG_USB_COMPOSITE) ||
defined(CONFIG_USB_COMPOSITE_MODULE)
+#define COMPOSITE_CONFIG_VALUE  3  /* composite config */
+#define GS_ACM_CONFIG_ID   COMPOSITE_CONFIG_VALUE
+#else
 #define GS_ACM_CONFIG_ID   2
+#endif
 
 #define GS_MAX_NUM_INTERFACES  2
 #define GS_BULK_INTERFACE_ID   0
@@ -97,6 +103,8 @@
 #define GS_SPEED_SELECT(is_hs,hs,fs) (fs)
 #endif /* CONFIG_USB_GADGET_DUALSPEED */
 
+#define GS_DEBUG 1
+
 /* debug settings */
 #ifdef GS_DEBUG
 static int debug = 1;
@@ -189,7 +197,7 @@
 /* tty driver */
 static int gs_open(struct tty_struct *tty, struct file *file);
 static void gs_close(struct tty_struct *tty, struct file *file);
-static int gs_write(struct tty_struct *tty, 
+static int gs_write(struct tty_struct *tty,
const unsigned char *buf, int count);
 static void gs_put_char(struct tty_struct *tty, unsigned char ch);
 static void gs_flush_chars(struct tty_struct *tty);
@@ -211,6 +219,16 @@
 static void gs_write_complete(struct usb_ep *ep, struct usb_request
*req);
 
 /* gadget driver */
+#ifdefined(CONFIG_USB_COMPOSITE) ||
defined(CONFIG_USB_COMPOSITE_MODULE)
+static int gs_bind(struct usb_composite_dev *cdev);
+static void gs_unbind(struct usb_composite_dev *cdev);
+static int gs_setup(struct usb_composite_dev *cdev,
+   const struct usb_ctrlrequest *ctrl);
+static int gs_setup_standard(struct usb_composite_dev *cdev,
+   const struct usb_ctrlrequest *ctrl);
+static int gs_setup_class(struct usb_composite_dev *cdev,
+   const struct usb_ctrlrequest *ctrl);
+#else
 static int gs_bind(struct usb_gadget *gadget);
 static void gs_unbind(struct usb_gadget *gadget);
 static int gs_setup(struct usb_gadget *gadget,
@@ -219,8 +237,13 @@
const struct usb_ctrlrequest *ctrl);
 static int gs_setup_class(struct usb_gadget *gadget,
const struct usb_ctrlrequest *ctrl);
+#endif
 static void gs_setup_complete(struct usb_ep *ep, struct usb_request
*req);
+#ifdefined(CONFIG_USB_COMPOSITE) ||
defined(CONFIG_USB_COMPOSITE_MODULE)
+static void gs_disconnect(struct usb_composite_dev *cdev);
+#else
 static void gs_disconnect(struct usb_gadget *gadget);
+#endif
 static int gs_set_config(struct gs_dev *dev, unsigned config);
 static void gs_reset_config(struct gs_dev *dev);
 static int gs_build_config_buf(u8 *buf, enum usb_device_speed speed,
@@ -286,7 +309,24 @@
.chars_in_buffer =  gs_chars_in_buffer,
 };
 static struct tty_driver *gs_tty_driver;
+static struct usb_gadget_strings gs_string_table;
+struct usb_descriptor_header *gs_acm_fullspeed_function[];
 
+#ifdefined(CONFIG_USB_COMPOSITE) ||
defined(CONFIG_USB_COMPOSITE_MODULE)
+/* USB_FUNCTION */
+struct usb_function gs_usb_function = {
+   .name   = GS_LONG_NAME,
+   .strings= gs_string_table,
+   .descriptors= gs_acm_fullspeed_function,
+#ifdef CONFIG_USB_GADGET_DUALSPEED
+   .hs_descriptors = gs_acm_highspeed_function,
+#endif
+   .bind   = gs_bind,
+   .unbind = gs_unbind,
+   .setup  = gs_setup,
+   .disconnect = gs_disconnect,
+};
+#else
 /* gadget driver struct */
 static struct usb_gadget_driver gs_gadget_driver = {
 #ifdef CONFIG_USB_GADGET_DUALSPEED
@@ -303,10 +343,21 @@
.name = GS_SHORT_NAME,
},
 };
+#endif
 
 
 /* USB descriptors */
 
+#ifdefined(CONFIG_USB_COMPOSITE) ||
defined(CONFIG_USB_COMPOSITE_MODULE)
+/* eth[11-20], serial[21-27], storage[31-35] */
+#define GS_MANUFACTURER_STR_ID 21
+#define GS_PRODUCT_STR_ID  22
+#define GS_SERIAL_STR_ID   23
+#define GS_BULK_CONFIG_STR_ID  24
+#define GS_ACM_CONFIG_STR_ID   25
+#define GS_CONTROL_STR_ID  26
+#define GS_DATA_STR_ID 27
+#else
 #define GS_MANUFACTURER_STR_ID 1
 #define GS_PRODUCT_STR_ID  2
 #define GS_SERIAL_STR_ID   3
@@ -314,6 +365,7 @@
 #define GS_ACM_CONFIG_STR_ID   5
 #define GS_CONTROL_STR_ID  6
 #define GS_DATA_STR_ID 7
+#endif /* End if Composite*/
 
 /* static strings, in UTF-8 */
 static char manufacturer[50];
@@ -375,7 +427,7 @@
.bMaxPower =1,
 };
 
-static const struct usb_interface_descriptor gs_bulk_interface_desc = {
+struct usb_interface_descriptor

[linux-usb-devel] [RFC] [PATCH 4/5]: Composite Devices Support

2007-02-02 Thread Felipe Balbi
[PATCH] g_file_storage modification for it to become a USB_FUNCTION.

Signed-off-by: Felipe Balbi [EMAIL PROTECTED]
Signed-off-by: Ragner Magalhaes [EMAIL PROTECTED]
---

Index: 2.6-dev/drivers/usb/gadget/file_storage.c
===
--- 2.6-dev.orig/drivers/usb/gadget/file_storage.c  2007-01-29
11:47:19.0 -0400
+++ 2.6-dev/drivers/usb/gadget/file_storage.c   2007-01-29
11:47:29.0 -0400
@@ -221,6 +221,10 @@
 #undef VERBOSE
 #undef DUMP_MSGS
 
+#define DEBUG 1
+#define VERBOSE 1
+#define DUMP_MSGS 1
+
 
 #include asm/system.h
 #include asm/uaccess.h
@@ -255,6 +259,7 @@
 
 #include linux/usb_ch9.h
 #include linux/usb_gadget.h
+#include linux/usb/composite.h
 
 #include gadget_chips.h
 
@@ -844,14 +849,32 @@
  * descriptors are built on demand.  Also the (static) config and
interface
  * descriptors are adjusted during fsg_bind().
  */
+#ifdefined(CONFIG_USB_COMPOSITE) ||
defined(CONFIG_USB_COMPOSITE_MODULE)
+/* eth[11-20], serial[21-27], storage[31-35] */
+#define STRING_MANUFACTURER31
+#define STRING_PRODUCT 32
+#define STRING_SERIAL  33
+#define STRING_CONFIG  34
+#define STRING_INTERFACE   35
+#else
 #define STRING_MANUFACTURER1
 #define STRING_PRODUCT 2
 #define STRING_SERIAL  3
 #define STRING_CONFIG  4
 #define STRING_INTERFACE   5
+#endif /* End if Composite*/
 
+/* If Composite Framework is enabled, we need a default configuration
value
+ * of 3. Else, we use the module's defaul
+ */
+#ifdefined(CONFIG_USB_COMPOSITE) ||
defined(CONFIG_USB_COMPOSITE_MODULE)
+#define COMPOSITE_CONFIG_VALUE  3  /* composite config */
 /* There is only one configuration. */
+#defineCONFIG_VALUECOMPOSITE_CONFIG_VALUE
+#else
+   /* There is only one configuration. */
 #defineCONFIG_VALUE1
+#endif
 
 static struct usb_device_descriptor
 device_desc = {
@@ -941,7 +964,7 @@
.bInterval =32, // frames - 32 ms
 };
 
-static const struct usb_descriptor_header *fs_function[] = {
+static struct usb_descriptor_header *fs_function[] = {
(struct usb_descriptor_header *) otg_desc,
(struct usb_descriptor_header *) intf_desc,
(struct usb_descriptor_header *) fs_bulk_in_desc,
@@ -1123,9 +1146,15 @@
  * completion of various requests: set config, set interface, and
  * Bulk-only device reset. */
 
+#if defined(CONFIG_USB_COMPOSITE) ||
defined(CONFIG_USB_COMPOSITE_MODULE)
+static void fsg_disconnect(struct usb_composite_dev *cdev)
+{
+   struct fsg_dev *fsg = cdev-current_func-driver_data;
+#else
 static void fsg_disconnect(struct usb_gadget *gadget)
 {
struct fsg_dev  *fsg = get_gadget_data(gadget);
+#endif
 
DBG(fsg, disconnect or port reset\n);
raise_exception(fsg, FSG_STATE_DISCONNECT);
@@ -1494,10 +1523,17 @@
 }
 
 
+#if defined(CONFIG_USB_COMPOSITE) ||
defined(CONFIG_USB_COMPOSITE_MODULE)
+static int fsg_setup(struct usb_composite_dev *cdev,
+   const struct usb_ctrlrequest *ctrl)
+{
+   struct fsg_dev *fsg = cdev-current_func-driver_data;
+#else
 static int fsg_setup(struct usb_gadget *gadget,
const struct usb_ctrlrequest *ctrl)
 {
struct fsg_dev  *fsg = get_gadget_data(gadget);
+#endif
int rc;
int w_length = le16_to_cpu(ctrl-wLength);
 
@@ -3705,9 +3741,16 @@
kref_put(fsg-ref, fsg_release);
 }
 
+
+#if defined(CONFIG_USB_COMPOSITE) ||
defined(CONFIG_USB_COMPOSITE_MODULE)
+static void /* __init_or_exit */ fsg_unbind(struct usb_composite_dev
*cdev)
+{
+   struct fsg_dev *fsg = cdev-current_func-driver_data;
+#else
 static void /* __init_or_exit */ fsg_unbind(struct usb_gadget *gadget)
 {
struct fsg_dev  *fsg = get_gadget_data(gadget);
+#endif
int i;
struct lun  *curlun;
struct usb_request  *req = fsg-ep0req;
@@ -3752,7 +3795,11 @@
usb_ep_free_request(fsg-ep0, req);
}
 
+#ifdefined(CONFIG_USB_COMPOSITE) ||
defined(CONFIG_USB_COMPOSITE_MODULE)
+   cdev-current_func-driver_data = NULL;
+#else
set_gadget_data(gadget, NULL);
+#endif
 }
 
 
@@ -3841,8 +3888,14 @@
 }
 
 
-static int __init fsg_bind(struct usb_gadget *gadget)
+#if defined(CONFIG_USB_COMPOSITE) ||
defined(CONFIG_USB_COMPOSITE_MODULE)
+static int __devinit fsg_bind(struct usb_composite_dev *cdev)
 {
+   struct usb_gadget *gadget = cdev-gadget;
+#else
+static int __devinit fsg_bind(struct usb_gadget *gadget)
+{
+#endif
struct fsg_dev  *fsg = the_fsg;
int rc;
int i;
@@ -3852,9 +3905,16 @@
char*pathbuf, *p;
 
fsg-gadget = gadget;
+#if defined(CONFIG_USB_COMPOSITE) ||
defined(CONFIG_USB_COMPOSITE_MODULE)
+   cdev-current_func-driver_data = fsg;
+#else

[linux-usb-devel] [RFC] [NOTES]: Composite Devices Support

2007-02-02 Thread Felipe Balbi
Hello all,

1. The patch series we're implemented using Linux OMAP git tree.

2. We didn't test it with the later Linus's git tree.

-- 
Best Regards,

Felipe Balbi
[EMAIL PROTECTED]

Nokia Institute of Technology - INdT
Kernel Developers Team

+55 92 2126 1003


-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


Re: [linux-usb-devel] Error -71 connecting IDEN phone

2006-11-30 Thread Felipe Balbi
did you already try David Brownell's patch??

According to him, this could be an sleep time error!

Below, Dave's patch:

Tweak some early enumeration code paths:

 - After a set_address() error, reset the port.  Failures in that
particular
   protocol request leave the device's address indeterminate.

 - Let devices settle longer after successful SET_ADDRESS

EXPERIMENTAL ... 

Index: g26/drivers/usb/core/hub.c
===
--- g26.orig/drivers/usb/core/hub.c 2006-11-06 13:08:45.0
-0800
+++ g26/drivers/usb/core/hub.c  2006-11-06 14:13:55.0 -0800
@@ -2010,6 +2010,8 @@ static int hub_set_address(struct usb_de
if (retval == 0) {
usb_set_device_state(udev, USB_STATE_ADDRESS);
ep0_reinit(udev);
+   /* allow HCD and peripheral time to settle */
+   msleep(40);
}
return retval;
 }
@@ -2195,24 +2197,27 @@ hub_port_init (struct usb_hub *hub, stru
 #undef GET_DESCRIPTOR_BUFSIZE
}
 
+   /* after set_address faults it's not clear what the
device's
+* address will be.  reset and be sure.
+*
+* REVISIT peripherals could trigger erroneous faults...
+*/
for (j = 0; j  SET_ADDRESS_TRIES; ++j) {
retval = hub_set_address(udev);
if (retval = 0)
break;
-   msleep(200);
+   (void) hub_port_reset(hub, port1, udev, delay);
}
if (retval  0) {
dev_err(udev-dev,
device not accepting address %d, error
%d\n,
udev-devnum, retval);
-   goto fail;
+   continue;
}
- 
+
/* cope with hardware quirkiness:
-*  - let SET_ADDRESS settle, some device hardware wants
it
 *  - read ep0 maxpacket even for high and low speed,
-*/
-   msleep(10);
+*/
if (USE_NEW_SCHEME(retry_counter))
break;

On Thu, 2006-11-30 at 11:05 -0600, ext Larry Fenske XX (BO/EUS) wrote:
 I turn on the options suggested by Felipe Balbi (CONFIG_PREEMPT and
 CONFIG_USB_DEBUG), along with applying David Brownell's patch and didn't
 get much more in /var/log/messages:
 
 Nov 30 09:57:12 usboc0203 kernel: [61382.237911] usb 5-1: new full speed
 USB device using uhci_hcd and address 10
 Nov 30 09:57:13 usboc0203 kernel: [61382.357608] usb 5-1: device
 descriptor read/64, error -71
 Nov 30 09:57:13 usboc0203 kernel: [61382.581016] usb 5-1: device
 descriptor read/64, error -71
 Nov 30 09:57:13 usboc0203 kernel: [61382.796455] usb 5-1: new full speed
 USB device using uhci_hcd and address 11
 Nov 30 09:57:13 usboc0203 kernel: [61382.916151] usb 5-1: device
 descriptor read/64, error -71
 Nov 30 09:57:13 usboc0203 kernel: [61383.139558] usb 5-1: device
 descriptor read/64, error -71
 Nov 30 09:57:14 usboc0203 kernel: [61383.355007] usb 5-1: new full speed
 USB device using uhci_hcd and address 12
 Nov 30 09:57:14 usboc0203 kernel: [61383.578414] usb 5-1: device not
 accepting address 12, error -71
 Nov 30 09:57:14 usboc0203 kernel: [61383.905561] usb 5-1: device not
 accepting address 12, error -71
 Nov 30 09:57:14 usboc0203 kernel: [61384.121014] usb 5-1: new full speed
 USB device using uhci_hcd and address 13
 Nov 30 09:57:15 usboc0203 kernel: [61384.344425] usb 5-1: device not
 accepting address 13, error -71
 Nov 30 09:57:15 usboc0203 kernel: [61384.671563] usb 5-1: device not
 accepting address 13, error -71 
 
 If I leave the device plugged in after these errors, I can never access
 it.  If I unplug and plug it in again, then sometimes it will connect.
 The successes and failures seem to come in runs, i.e. the chance of
 success or failure is influenced by a previous success or failure.
 
 Is there any other debugging that I can turn on to get more information
 from the driver?
 
 Thanks,
 - Larry Fenske
 
 -Original Message-
 From: Felipe Balbi [mailto:[EMAIL PROTECTED] 
 Sent: Wednesday, November 29, 2006 11:59
 To: Larry Fenske XX (BO/EUS)
 Cc: Oliver Neukum; linux-usb-devel@lists.sourceforge.net
 Subject: Re: [linux-usb-devel] Error -71 connecting IDEN phone
 
 * PGP Signed by an unknown key: 11/29/2006 at 07:58:59 PM
 
 ext Larry Fenske XX (BO/EUS) wrote:
  Yes, other devices work.  I tried a USB flash drive (a.k.a. thumb
 drive).  It works fine in both USB ports that I tried it in.  I can read
 the filesystem on it.
  
  - Larry
  
  -Original Message-
  From: Oliver Neukum [mailto:[EMAIL PROTECTED] 
  Sent: Wednesday, November 29, 2006 2:49 AM
  To: linux-usb-devel@lists.sourceforge.net
  Cc: Larry Fenske XX (BO/EUS)
  Subject: Re: [linux-usb-devel] Error -71 connecting IDEN

Re: [linux-usb-devel] Error -71 connecting IDEN phone

2006-11-29 Thread Felipe Balbi
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

ext Larry Fenske XX (BO/EUS) wrote:
 Yes, other devices work.  I tried a USB flash drive (a.k.a. thumb drive).  It 
 works fine in both USB ports that I tried it in.  I can read the filesystem 
 on it.
 
 - Larry
 
 -Original Message-
 From: Oliver Neukum [mailto:[EMAIL PROTECTED] 
 Sent: Wednesday, November 29, 2006 2:49 AM
 To: linux-usb-devel@lists.sourceforge.net
 Cc: Larry Fenske XX (BO/EUS)
 Subject: Re: [linux-usb-devel] Error -71 connecting IDEN phone
 
 Am Dienstag, 28. November 2006 23:10 schrieb Larry Fenske XX (BO/EUS):
 I am attempting to connect a Motorola IDEN phone to a Linux box.  Most
 of the time I get an error -71 in /var/log/messages. Here are six failed
 attempts:
 
As define in include/linux/asm-generic/errno.h the error -71 is a
Protocol Error...
As we can see from kernel messages:

 usb 5-1: new full speed USB device using address 2
 usb 5-1: device not accepting address 2, error -71

The USB Host is not being able to set a device address...

Could you please set CONFIG_PREEMPT and CONFIG_USB_DEBUG on the HOST
side... and send more verbose messages??

Another thing: Can you access the device anytime later?? If after some
error messages you're able to access the device it could be some
device-specific config...



 Do any other USB devices work?
 
   Regards
   Oliver
 
 -
 Take Surveys. Earn Cash. Influence the Future of IT
 Join SourceForge.net's Techsay panel and you'll get the chance to share your
 opinions on IT  business topics through brief surveys - and earn cash
 http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
 ___
 linux-usb-devel@lists.sourceforge.net
 To unsubscribe, use the last form field at:
 https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


- --
Best Regards,

Felipe Balbi
[EMAIL PROTECTED]
OSMRC - INdT
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.3 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFbdhzSZ+ls6uhC2QRAtZ+AKCdFumpN0ePy1wCszfJFBLpFlSYrACfel8b
6K+bybng5V3/uwRMwQL00W0=
=j3+5
-END PGP SIGNATURE-

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


Re: [linux-usb-devel] usb register

2006-11-01 Thread Felipe Balbi


ext Jim wrote:
 Hi,

 In function usb_register(), there is a comment of NOTE: if you want 
 your driver to use the USB major number, you must call 
 usb_register_dev() to enable that functionality. This function no longer 
 takes care of that.. Does that mean that init() need to call 
 usb_register_dev(), not usb_register()?

 I am running usb-skeleton.c for an experiment on kernel 2.6, the 
 usb_skel_init() was invoked during insmod, but the usb_skel_init only 
 called the usb_register(), not usb_register_dev(). The skel_probe was 
 not called even when I plugged in a device to the usb port. The driver 
 was made for a major number = 180 (mknode /dev/skel0 c 180 0), but to 
 open /dev/skel0 was always an error of No Such Device. Why the 
 usb_skel_init was running, but the device could not be opened? How can I 
 debug this problem?

 Thank you.

 Jim

 -
 Using Tomcat but need to do more? Need to support web services, security?
 Get stuff done quickly with pre-integrated technology to make your job easier
 Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
 http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
 ___
 linux-usb-devel@lists.sourceforge.net
 To unsubscribe, use the last form field at:
 https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
   
This note warns you to call usb_register_dev() instead of usb_register();
usb_register() and usb_register_dev() are usually called from init() 
functions.

Hope this helped! ;-)

-- 
Best Regards,

Felipe Balbi
[EMAIL PROTECTED]
OSMRC - INdT


-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] Invalid Storage Class BUG

2006-11-01 Thread Felipe Balbi
Hello all,

Could anyone help me fix this bug?

I couldn't figure out what is happening.

Here's the bug:
drivers/usb/core/hub.c: In function 'usb_new_device':
drivers/usb/core/hub.c:1293: error: invalid storage class for function 
'__usb_port_suspend'
drivers/usb/core/hub.c:1294: warning: implicit declaration of function 
'__usb_port_suspend'
drivers/usb/core/hub.c: At top level:
drivers/usb/core/hub.c:1567: error: static declaration of 
'__usb_port_suspend' follows non-static declaration
drivers/usb/core/hub.c:1294: error: previous implicit declaration of 
'__usb_port_suspend' was here
make[3]: *** [drivers/usb/core/hub.o] Error 1
make[2]: *** [drivers/usb/core] Error 2
make[1]: *** [drivers/usb] Error 2
make: *** [drivers] Error 2


Here's the source code:

 /* Maybe it can talk to us, though we can't talk to it.
 * (Includes HNP test device.)
 */
if (udev-bus-b_hnp_enable || udev-bus-is_b_host) {
static int __usb_port_suspend(struct usb_device *,
int port1);   * (line 1293)*
err = __usb_port_suspend(udev, 
udev-bus-otg_port); * (line 1294)*
if (err  0)
dev_dbg(udev-dev, HNP fail, %d\n, err);
}
err = -ENODEV;
goto fail;
}


static int __usb_port_suspend (struct usb_device *udev, int port1)
{ * (line 1567)*
int status = 0;

/* caller owns the udev device lock */
if (port1  0)
return port1;

/* we change the device's upstream USB link,
 * but root hubs have no upstream USB link.
 */
if (udev-parent)
status = hub_port_suspend(hdev_to_hub(udev-parent), port1,
udev);
else {
dev_dbg(udev-dev, usb %ssuspend\n,
udev-auto_pm ? auto- : );
usb_set_device_state(udev, USB_STATE_SUSPENDED);
}
return status;
}


-- 
Best Regards,

Felipe Balbi
[EMAIL PROTECTED]
OSMRC - INdT


-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel