Re: [patch] fix urtw on big-endian CPU (PPC)

2015-12-18 Thread Stefan Sperling
On Mon, Dec 07, 2015 at 11:02:51PM +0100, Stefan Sperling wrote:
> On Mon, Dec 07, 2015 at 09:31:11PM +0100, Cédric TESSIER wrote:
> > Hi,
> > 
> > I'm bringing my old Mac Mini G4 back to life, and I had an issue with a
> > wireless dongle (RTL8187 rev 0x04, RFv2).
> > 
> > urtw interface was available, but wasn't working at all.
> > 
> > Investigations highlighted an endianness related issue.
> > 
> > I've written a quick and dirty patch which make the interface fully working
> > again.
> > 
> > I've tested it on PPC and i386 (5.8 and snapshot).
> > 
> > 
> > Cédric
> 
> Thanks. I do have the necessary hardware to test this.
> I'll try to get that done this week and get your fix committed.

Committed, thanks!

> > 
> > 
> > 
> > --- if_urtw.c.orig  2015-11-25 04:10:00.0 +0100
> > +++ if_urtw.c   2015-12-07 11:40:05.0 +0100
> > @@ -1078,6 +1078,7 @@
> > USETW(req.wIndex, index);
> > USETW(req.wLength, sizeof(uint16_t));
> >  
> > +   data = htole16(data);   
> > return (usbd_do_request(sc->sc_udev, &req, &data));
> >  }
> >  
> > @@ -1587,6 +1588,7 @@
> > USETW(req.wLength, sizeof(uint16_t));
> >  
> > error = usbd_do_request(sc->sc_udev, &req, data);
> > +   *data = letoh16(*data);
> > return (error);
> >  }
> >  
> > @@ -1603,6 +1605,7 @@
> > USETW(req.wLength, sizeof(uint32_t));
> >  
> > error = usbd_do_request(sc->sc_udev, &req, data);
> > +   *data = letoh32(*data);
> > return (error);
> >  }
> >  
> > @@ -1645,6 +1648,7 @@
> > USETW(req.wIndex, idx & 0x03);
> > USETW(req.wLength, sizeof(uint16_t));
> >  
> > +   data = htole16(data);   
> > return (usbd_do_request(sc->sc_udev, &req, &data));
> >  }
> >  
> > @@ -1659,6 +1663,7 @@
> > USETW(req.wIndex, idx & 0x03);
> > USETW(req.wLength, sizeof(uint32_t));
> >  
> > +   data = htole32(data);   
> > return (usbd_do_request(sc->sc_udev, &req, &data));
> >  }
> >  
> > 
> 



Re: [patch] fix urtw on big-endian CPU (PPC)

2015-12-07 Thread Stefan Sperling
On Mon, Dec 07, 2015 at 09:31:11PM +0100, Cédric TESSIER wrote:
> Hi,
> 
> I'm bringing my old Mac Mini G4 back to life, and I had an issue with a
> wireless dongle (RTL8187 rev 0x04, RFv2).
> 
> urtw interface was available, but wasn't working at all.
> 
> Investigations highlighted an endianness related issue.
> 
> I've written a quick and dirty patch which make the interface fully working
> again.
> 
> I've tested it on PPC and i386 (5.8 and snapshot).
> 
> 
> Cédric

Thanks. I do have the necessary hardware to test this.
I'll try to get that done this week and get your fix committed.

> 
> 
> 
> --- if_urtw.c.orig2015-11-25 04:10:00.0 +0100
> +++ if_urtw.c 2015-12-07 11:40:05.0 +0100
> @@ -1078,6 +1078,7 @@
>   USETW(req.wIndex, index);
>   USETW(req.wLength, sizeof(uint16_t));
>  
> + data = htole16(data);   
>   return (usbd_do_request(sc->sc_udev, &req, &data));
>  }
>  
> @@ -1587,6 +1588,7 @@
>   USETW(req.wLength, sizeof(uint16_t));
>  
>   error = usbd_do_request(sc->sc_udev, &req, data);
> + *data = letoh16(*data);
>   return (error);
>  }
>  
> @@ -1603,6 +1605,7 @@
>   USETW(req.wLength, sizeof(uint32_t));
>  
>   error = usbd_do_request(sc->sc_udev, &req, data);
> + *data = letoh32(*data);
>   return (error);
>  }
>  
> @@ -1645,6 +1648,7 @@
>   USETW(req.wIndex, idx & 0x03);
>   USETW(req.wLength, sizeof(uint16_t));
>  
> + data = htole16(data);   
>   return (usbd_do_request(sc->sc_udev, &req, &data));
>  }
>  
> @@ -1659,6 +1663,7 @@
>   USETW(req.wIndex, idx & 0x03);
>   USETW(req.wLength, sizeof(uint32_t));
>  
> + data = htole32(data);   
>   return (usbd_do_request(sc->sc_udev, &req, &data));
>  }
>  
> 



[patch] fix urtw on big-endian CPU (PPC)

2015-12-07 Thread Cédric TESSIER
Hi,

I'm bringing my old Mac Mini G4 back to life, and I had an issue with a
wireless dongle (RTL8187 rev 0x04, RFv2).

urtw interface was available, but wasn't working at all.

Investigations highlighted an endianness related issue.

I've written a quick and dirty patch which make the interface fully working
again.

I've tested it on PPC and i386 (5.8 and snapshot).


Cédric



--- if_urtw.c.orig  2015-11-25 04:10:00.0 +0100
+++ if_urtw.c   2015-12-07 11:40:05.0 +0100
@@ -1078,6 +1078,7 @@
USETW(req.wIndex, index);
USETW(req.wLength, sizeof(uint16_t));
 
+   data = htole16(data);   
return (usbd_do_request(sc->sc_udev, &req, &data));
 }
 
@@ -1587,6 +1588,7 @@
USETW(req.wLength, sizeof(uint16_t));
 
error = usbd_do_request(sc->sc_udev, &req, data);
+   *data = letoh16(*data);
return (error);
 }
 
@@ -1603,6 +1605,7 @@
USETW(req.wLength, sizeof(uint32_t));
 
error = usbd_do_request(sc->sc_udev, &req, data);
+   *data = letoh32(*data);
return (error);
 }
 
@@ -1645,6 +1648,7 @@
USETW(req.wIndex, idx & 0x03);
USETW(req.wLength, sizeof(uint16_t));
 
+   data = htole16(data);   
return (usbd_do_request(sc->sc_udev, &req, &data));
 }
 
@@ -1659,6 +1663,7 @@
USETW(req.wIndex, idx & 0x03);
USETW(req.wLength, sizeof(uint32_t));
 
+   data = htole32(data);   
return (usbd_do_request(sc->sc_udev, &req, &data));
 }