Re: [PATCH] uticom driver fix

2010-12-15 Thread Daniel Gracia

Yep! That's enough for my adapters.

El 14/12/2010 21:54, Jonathan Gray escribis:


such things should be seperate diffs, and these should go to tech.

is the following enough to make it work?

Index: uticom.c
===
RCS file: /cvs/src/sys/dev/usb/uticom.c,v
retrieving revision 1.7
diff -u -p -r1.7 uticom.c
--- uticom.c3 Dec 2010 17:02:29 -   1.7
+++ uticom.c14 Dec 2010 20:52:23 -
@@ -209,7 +209,6 @@ uticom_attach(struct device *parent, str
struct uticom_softc *sc = (struct uticom_softc *)self;
struct usb_attach_arg *uaa = aux;
usbd_device_handle dev = uaa-device;
-   usbd_interface_handle iface;
usb_config_descriptor_t *cdesc;
usb_interface_descriptor_t *id;
usb_endpoint_descriptor_t *ed;
@@ -381,7 +380,7 @@ fwload_done:
sc-sc_iface_number = id-bInterfaceNumber;

for (i = 0; i  id-bNumEndpoints; i++) {
-   ed = usbd_interface2endpoint_descriptor(iface, i);
+   ed = usbd_interface2endpoint_descriptor(sc-sc_iface, i);
if (ed == NULL) {
printf(%s: no endpoint descriptor for %d\n,
sc-sc_dev.dv_xname, i);
@@ -419,7 +418,7 @@ fwload_done:
uca.obufsize = UTICOM_OBUFSZ;
uca.ibufsizepad = UTICOM_IBUFSZ;
uca.device = dev;
-   uca.iface = iface;
+   uca.iface = sc-sc_iface;
uca.opkthdrlen = 0;
uca.methods =uticom_methods;
uca.arg = sc;




Re: [PATCH] uticom driver fix

2010-12-14 Thread Daniel Gracia

El 12/12/2010 0:13, Jonathan Gray escribis:

On Tue, Dec 07, 2010 at 10:06:59AM +0100, Daniel Gracia wrote:

Hi there!

Being in need of uticom driver noticed that it didn't worked out of
the box. Compiled, but opening the serial port twice panics the
kernel.

With the attached fix applyed to sys/dev/usb/uticom.c it's working
for me now with single port devices.


The iface part looks right, but why change the bufsize handling?
Dmitry Komissaroff's original code seems to have it the way it
currently is.


Sure original numbers worked ok; just trying to remove some black magic.



Re: [PATCH] uticom driver fix

2010-12-14 Thread Jonathan Gray
On Tue, Dec 14, 2010 at 04:43:23PM +0100, Daniel Gracia wrote:
 El 12/12/2010 0:13, Jonathan Gray escribis:
 On Tue, Dec 07, 2010 at 10:06:59AM +0100, Daniel Gracia wrote:
 Hi there!
 
 Being in need of uticom driver noticed that it didn't worked out of
 the box. Compiled, but opening the serial port twice panics the
 kernel.
 
 With the attached fix applyed to sys/dev/usb/uticom.c it's working
 for me now with single port devices.
 
 The iface part looks right, but why change the bufsize handling?
 Dmitry Komissaroff's original code seems to have it the way it
 currently is.
 
 Sure original numbers worked ok; just trying to remove some black magic.

such things should be seperate diffs, and these should go to tech.

is the following enough to make it work?

Index: uticom.c
===
RCS file: /cvs/src/sys/dev/usb/uticom.c,v
retrieving revision 1.7
diff -u -p -r1.7 uticom.c
--- uticom.c3 Dec 2010 17:02:29 -   1.7
+++ uticom.c14 Dec 2010 20:52:23 -
@@ -209,7 +209,6 @@ uticom_attach(struct device *parent, str
struct uticom_softc *sc = (struct uticom_softc *)self;
struct usb_attach_arg *uaa = aux;
usbd_device_handle dev = uaa-device;
-   usbd_interface_handle iface;
usb_config_descriptor_t *cdesc;
usb_interface_descriptor_t *id;
usb_endpoint_descriptor_t *ed;
@@ -381,7 +380,7 @@ fwload_done:
sc-sc_iface_number = id-bInterfaceNumber;
 
for (i = 0; i  id-bNumEndpoints; i++) {
-   ed = usbd_interface2endpoint_descriptor(iface, i);
+   ed = usbd_interface2endpoint_descriptor(sc-sc_iface, i);
if (ed == NULL) {
printf(%s: no endpoint descriptor for %d\n,
sc-sc_dev.dv_xname, i);
@@ -419,7 +418,7 @@ fwload_done:
uca.obufsize = UTICOM_OBUFSZ;
uca.ibufsizepad = UTICOM_IBUFSZ;
uca.device = dev;
-   uca.iface = iface;
+   uca.iface = sc-sc_iface;
uca.opkthdrlen = 0;
uca.methods = uticom_methods;
uca.arg = sc;



Re: [PATCH] uticom driver fix

2010-12-11 Thread Jonathan Gray
On Tue, Dec 07, 2010 at 10:06:59AM +0100, Daniel Gracia wrote:
 Hi there!
 
 Being in need of uticom driver noticed that it didn't worked out of
 the box. Compiled, but opening the serial port twice panics the
 kernel.
 
 With the attached fix applyed to sys/dev/usb/uticom.c it's working
 for me now with single port devices.

The iface part looks right, but why change the bufsize handling?
Dmitry Komissaroff's original code seems to have it the way it
currently is.



[PATCH] uticom driver fix

2010-12-10 Thread Daniel Gracia

Hi there!

Being in need of uticom driver noticed that it didn't worked out of the 
box. Compiled, but opening the serial port twice panics the kernel.


With the attached fix applyed to sys/dev/usb/uticom.c it's working for 
me now with single port devices.


Regards,

Dani

Patch
==
--- uticom.cSat Nov 20 20:11:19 2010
+++ uticom.cWed Dec  1 10:55:47 2010
@@ -209,7 +209,6 @@
 struct uticom_softc *sc = (struct uticom_softc *)self;
 struct usb_attach_arg *uaa = aux;
 usbd_device_handle dev = uaa-device;
-usbd_interface_handle iface;
 usb_config_descriptor_t *cdesc;
 usb_interface_descriptor_t *id;
 usb_endpoint_descriptor_t *ed;
@@ -381,7 +380,7 @@
 sc-sc_iface_number = id-bInterfaceNumber;

 for (i = 0; i  id-bNumEndpoints; i++) {
-ed = usbd_interface2endpoint_descriptor(iface, i);
+ed = usbd_interface2endpoint_descriptor(sc-sc_iface, i);
 if (ed == NULL) {
 printf(%s: no endpoint descriptor for %d\n,
 sc-sc_dev.dv_xname, i);
@@ -392,9 +391,12 @@
 if (UE_GET_DIR(ed-bEndpointAddress) == UE_DIR_IN 
 UE_GET_XFERTYPE(ed-bmAttributes) == UE_BULK) {
 uca.bulkin = ed-bEndpointAddress;
+uca.ibufsize = UGETW(ed-wMaxPacketSize);
+uca.ibufsizepad = UGETW(ed-wMaxPacketSize);
 } else if (UE_GET_DIR(ed-bEndpointAddress) == UE_DIR_OUT 
 UE_GET_XFERTYPE(ed-bmAttributes) == UE_BULK) {
 uca.bulkout = ed-bEndpointAddress;
+uca.obufsize = UGETW(ed-wMaxPacketSize);
 }
 }

@@ -415,11 +417,8 @@
 sc-sc_dtr = sc-sc_rts = -1;

 uca.portno = UCOM_UNK_PORTNO;
-uca.ibufsize = UTICOM_IBUFSZ;
-uca.obufsize = UTICOM_OBUFSZ;
-uca.ibufsizepad = UTICOM_IBUFSZ;
 uca.device = dev;
-uca.iface = iface;
+uca.iface = sc-sc_iface;
 uca.opkthdrlen = 0;
 uca.methods = uticom_methods;
 uca.arg = sc;