Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 5 Feb 2015 20:55:02 +0900
From:      "Lundberg, Johannes" <johannes@brilliantservice.co.jp>
To:        "freebsd-usb@freebsd.org" <freebsd-usb@freebsd.org>
Subject:   Macbook touchpad wsp
Message-ID:  <CAASDrVnob4A%2B5-4vHRw6sTAingq=CqNgsdACQHK_35Pdb=jZVg@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
SGkNCg0KQWZ0ZXIgc29tZSB0aW1lIGF3YXkgSSBpbnN0YWxsZWQgdGhlIG5ld2VzdCBzbmFwc2hv
dCBvbiBteSBtYWNib29rIGFpciAyMDEzLg0KSSdtIGNlcnRhaW4gdGhhdCB0aGUgd3NwIGRyaXZl
ciB3b3JrZWQgYmVmb3JlIGJ1dCBub3cgSSBjYW4ndCBzZWVtIHRvIGdldA0KaXQgdG8gcmVjb2du
aXplIG15IG1hY2Jvb2sncyB0b3VjaHBhZC4uIEkgY29uZmlybSB0aGF0IHRoZSBwcm9kdWN0IGlk
IGlzDQpsaXN0ZWQgaW4gd3NwLmMgYnV0IG5vdGhpbmcgaGFwcGVucyB3aGVuIEkgbG9hZCB0aGUg
bW9kdWxlLi4NCg0KQW55IGlkZWEgd2hhdCBoYXMgaGFwcGVuZWQ/DQotLQ0KSm9oYW5uZXMgTHVu
ZGJlcmcNCkJSSUxMSUFOVFNFUlZJQ0UgQ08uLCBMVEQuDQoKLS0gCj0tPS09LT0tPS09LT0tPS09
LT0tPS09LT0tPS09LT0tPS09LT0tPS09LT0tPS09LT0tPS09LQrnp5jlr4bkv53mjIHjgavjgaTj
gYTjgabvvJrjgZPjga7pm7vlrZDjg6Hjg7zjg6vjga/jgIHlkI3lrpvkurrjgavpgIHkv6HjgZfj
gZ/jgoLjga7jgafjgYLjgorjgIHnp5jljL/nibnmqKnjga7lr77osaHjgajjgarjgovmg4XloLHj
gpLlkKvjgpPjgafjgYTjgb7jgZnjgIIK44KC44GX44CB5ZCN5a6b5Lq65Lul5aSW44Gu5pa544GM
5Y+X5L+h44GV44KM44Gf5aC05ZCI44CB44GT44Gu44Oh44O844Or44Gu56C05qOE44CB44GK44KI
44Gz44GT44Gu44Oh44O844Or44Gr6Zai44GZ44KL5LiA5YiH44Gu6ZaL56S644CBCuikh+WGmeOA
gemFjeW4g+OAgeOBneOBruS7luOBruWIqeeUqOOAgeOBvuOBn+OBr+iomOi8ieWGheWuueOBq+Wf
uuOBpeOBj+OBhOOBi+OBquOCi+ihjOWLleOCguOBleOCjOOBquOBhOOCiOOBhuOBiumhmOOBhOeU
s+OBl+S4iuOBkuOBvuOBmeOAggotLS0KQ09ORklERU5USUFMSVRZIE5PVEU6IFRoZSBpbmZvcm1h
dGlvbiBpbiB0aGlzIGVtYWlsIGlzIGNvbmZpZGVudGlhbAphbmQgaW50ZW5kZWQgc29sZWx5IGZv
ciB0aGUgYWRkcmVzc2VlLgpEaXNjbG9zdXJlLCBjb3B5aW5nLCBkaXN0cmlidXRpb24gb3IgYW55
IG90aGVyIGFjdGlvbiBvZiB1c2Ugb2YgdGhpcwplbWFpbCBieSBwZXJzb24gb3RoZXIgdGhhbiBp
bnRlbmRlZCByZWNpcGllbnQsIGlzIHByb2hpYml0ZWQuCklmIHlvdSBhcmUgbm90IHRoZSBpbnRl
bmRlZCByZWNpcGllbnQgYW5kIGhhdmUgcmVjZWl2ZWQgdGhpcyBlbWFpbCBpbgplcnJvciwgcGxl
YXNlIGRlc3Ryb3kgdGhlIG9yaWdpbmFsIG1lc3NhZ2UuCg==
From owner-freebsd-usb@FreeBSD.ORG  Thu Feb  5 15:34:41 2015
Return-Path: <owner-freebsd-usb@FreeBSD.ORG>
Delivered-To: freebsd-usb@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 373C03D7
 for <freebsd-usb@freebsd.org>; Thu,  5 Feb 2015 15:34:41 +0000 (UTC)
Received: from ns.kevlo.org (220-135-115-6.HINET-IP.hinet.net [220.135.115.6])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256
 bits))
 (Client CN "ns.kevlo.org", Issuer "ns.kevlo.org" (not verified))
 by mx1.freebsd.org (Postfix) with ESMTPS id D9AD3CB0
 for <freebsd-usb@freebsd.org>; Thu,  5 Feb 2015 15:34:39 +0000 (UTC)
Received: from ns.kevlo.org (localhost [127.0.0.1])
 by ns.kevlo.org (8.14.9/8.14.9) with ESMTP id t15FXusu085816
 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO);
 Thu, 5 Feb 2015 23:33:57 +0800 (CST)
 (envelope-from kevlo@ns.kevlo.org)
Received: (from kevlo@localhost)
 by ns.kevlo.org (8.14.9/8.14.9/Submit) id t15FXtaM085815;
 Thu, 5 Feb 2015 23:33:55 +0800 (CST) (envelope-from kevlo)
Date: Thu, 5 Feb 2015 23:33:55 +0800
From: Kevin Lo <kevlo@FreeBSD.org>
To: Rick van der Zwet <info@rickvanderzwet.nl>
Subject: Re: Realtek RTL8152 driver attempt
Message-ID: <20150205153355.GA85786@ns.kevlo.org>
References: <54D32724.60307@rickvanderzwet.nl>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <54D32724.60307@rickvanderzwet.nl>
User-Agent: Mutt/1.5.23 (2014-03-12)
Cc: freebsd-usb@freebsd.org
X-BeenThere: freebsd-usb@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: FreeBSD support for USB <freebsd-usb.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/options/freebsd-usb>,
 <mailto:freebsd-usb-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/freebsd-usb/>;
List-Post: <mailto:freebsd-usb@freebsd.org>
List-Help: <mailto:freebsd-usb-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-usb>,
 <mailto:freebsd-usb-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 05 Feb 2015 15:34:41 -0000

On Thu, Feb 05, 2015 at 09:17:40AM +0100, Rick van der Zwet wrote:
> 
> Hi Folks,

Hi Rick,

> I have been trying to write a FreeBSD driver (if_rtl) for the Realtek 
> RTL8152 chipset, which is a USB to Ethernet dongle (using the Sitecom 
> LN-030 v3).

What a coincidence.  I've been slowly working on porting r8152 driver from
Linux to FreeBSD since last month.

> Some more details on the device:
> [root@vbsd101 /usr/src]# usbconfig  -d ugen1.2 dump_device_desc
> ugen1.2: <USB 10100 LAN Realtek> at usbus1, cfg=0 md=HOST spd=HIGH 
> (480Mbps) pwr=ON (100mA)
> 
>    bLength = 0x0012
>    bDescriptorType = 0x0001
>    bcdUSB = 0x0210
>    bDeviceClass = 0x0000
>    bDeviceSubClass = 0x0000
>    bDeviceProtocol = 0x0000
>    bMaxPacketSize0 = 0x0040
>    idVendor = 0x0bda
>    idProduct = 0x8152
>    bcdDevice = 0x2000
>    iManufacturer = 0x0001  <Realtek>
>    iProduct = 0x0002  <USB 10/100 LAN>
>    iSerialNumber = 0x0003  <64D1A3318180>
>    bNumConfigurations = 0x0002
> 
> 
> 
> [root@vbsd101 /usr/src]# usbconfig  -d ugen1.2 dump_all_config_desc
> ugen1.2: <USB 10100 LAN Realtek> at usbus1, cfg=0 md=HOST spd=HIGH 
> (480Mbps) pwr=ON (100mA)
> 
> 
>   Configuration index 0
> 
>      bLength = 0x0009
>      bDescriptorType = 0x0002
>      wTotalLength = 0x0027
>      bNumInterfaces = 0x0001
>      bConfigurationValue = 0x0001
>      iConfiguration = 0x0000  <no string>
>      bmAttributes = 0x00a0
>      bMaxPower = 0x0032
> 
>      Interface 0
>        bLength = 0x0009
>        bDescriptorType = 0x0004
>        bInterfaceNumber = 0x0000
>        bAlternateSetting = 0x0000
>        bNumEndpoints = 0x0003
>        bInterfaceClass = 0x00ff
>        bInterfaceSubClass = 0x00ff
>        bInterfaceProtocol = 0x0000
>        iInterface = 0x0000  <no string>
> 
>       Endpoint 0
>          bLength = 0x0007
>          bDescriptorType = 0x0005
>          bEndpointAddress = 0x0081  <IN>
>          bmAttributes = 0x0002  <BULK>
>          wMaxPacketSize = 0x0200
>          bInterval = 0x0000
>          bRefresh = 0x0000
>          bSynchAddress = 0x0000
> 
>       Endpoint 1
>          bLength = 0x0007
>          bDescriptorType = 0x0005
>          bEndpointAddress = 0x0002  <OUT>
>          bmAttributes = 0x0002  <BULK>
>          wMaxPacketSize = 0x0200
>          bInterval = 0x0000
>          bRefresh = 0x0000
>          bSynchAddress = 0x0000
> 
>       Endpoint 2
>          bLength = 0x0007
>          bDescriptorType = 0x0005
>          bEndpointAddress = 0x0083  <IN>
>          bmAttributes = 0x0003  <INTERRUPT>
>          wMaxPacketSize = 0x0002
>          bInterval = 0x0008
>          bRefresh = 0x0000
>          bSynchAddress = 0x0000
> 
> 
> 
>   Configuration index 1
> 
>      bLength = 0x0009
>      bDescriptorType = 0x0002
>      wTotalLength = 0x0050
>      bNumInterfaces = 0x0002
>      bConfigurationValue = 0x0002
>      iConfiguration = 0x0000  <no string>
>      bmAttributes = 0x00a0
>      bMaxPower = 0x0032
> 
>      Interface 0
>        bLength = 0x0009
>        bDescriptorType = 0x0004
>        bInterfaceNumber = 0x0000
>        bAlternateSetting = 0x0000
>        bNumEndpoints = 0x0001
>        bInterfaceClass = 0x0002
>        bInterfaceSubClass = 0x0006
>        bInterfaceProtocol = 0x0000
>        iInterface = 0x0005  <CDC Communications Control>
> 
>        Additional Descriptor
> 
>        bLength = 0x05
>        bDescriptorType = 0x24
>        bDescriptorSubType = 0x00
>         RAW dump:
>         0x00 | 0x05, 0x24, 0x00, 0x10, 0x01
> 
> 
>        Additional Descriptor
> 
>        bLength = 0x05
>        bDescriptorType = 0x24
>        bDescriptorSubType = 0x06
>         RAW dump:
>         0x00 | 0x05, 0x24, 0x06, 0x00, 0x01
> 
> 
>        Additional Descriptor
> 
>        bLength = 0x0d
>        bDescriptorType = 0x24
>        bDescriptorSubType = 0x0f
>         RAW dump:
>         0x00 | 0x0d, 0x24, 0x0f, 0x03, 0x00, 0x00, 0x00, 0x00,
>         0x08 | 0xea, 0x05, 0x00, 0x00, 0x00
> 
> 
>       Endpoint 0
>          bLength = 0x0007
>          bDescriptorType = 0x0005
>          bEndpointAddress = 0x0083  <IN>
>          bmAttributes = 0x0003  <INTERRUPT>
>          wMaxPacketSize = 0x0010
>          bInterval = 0x0008
>          bRefresh = 0x0000
>          bSynchAddress = 0x0000
> 
> 
>      Interface 1
>        bLength = 0x0009
>        bDescriptorType = 0x0004
>        bInterfaceNumber = 0x0001
>        bAlternateSetting = 0x0000
>        bNumEndpoints = 0x0000
>        bInterfaceClass = 0x000a
>        bInterfaceSubClass = 0x0000
>        bInterfaceProtocol = 0x0000
>        iInterface = 0x0000  <no string>
> 
> 
>      Interface 1 Alt 1
>        bLength = 0x0009
>        bDescriptorType = 0x0004
>        bInterfaceNumber = 0x0001
>        bAlternateSetting = 0x0001
>        bNumEndpoints = 0x0002
>        bInterfaceClass = 0x000a
>        bInterfaceSubClass = 0x0000
>        bInterfaceProtocol = 0x0000
>        iInterface = 0x0004  <Ethernet Data>
> 
>       Endpoint 0
>          bLength = 0x0007
>          bDescriptorType = 0x0005
>          bEndpointAddress = 0x0081  <IN>
>          bmAttributes = 0x0002  <BULK>
>          wMaxPacketSize = 0x0200
>          bInterval = 0x0000
>          bRefresh = 0x0000
>          bSynchAddress = 0x0000
> 
>       Endpoint 1
>          bLength = 0x0007
>          bDescriptorType = 0x0005
>          bEndpointAddress = 0x0002  <OUT>
>          bmAttributes = 0x0002  <BULK>
>          wMaxPacketSize = 0x0200
>          bInterval = 0x0000
>          bRefresh = 0x0000
>          bSynchAddress = 0x0000
> 
> 
> Unfortunately there is no datasheet available, I quote ``` Due to 
> company policy, we only release Datasheet to our ODM/OEM (which have 
> signed a company to company NDA with Realtek). Please follow the linux 
> source code for porting, thanks.''' so I am stuck with 'reverse' 
> engineering and best guessing.

I contacted with a Linux driver maintainer and asked if he could 
provide me the data sheet of RTL8152, not surprisingly, he couldn't
send me a copy, but he would try to answer my questions.

> When looking at the usb trace on Linux with wireshark 
> (https://rickvanderzwet.nl/svn/personal/freebsd-rtl-driver/linux-trace.pcapng.gz) 
> I see a "CDC" like packets passing by, the description of the chipset 
> also hints something in this way: "Supports CDC-ECM".
> 
> 
> [root@vbsd101 /usr/src]# usbconfig -d ugen1.2 set_config 1
> 
> [root@vbsd101 /usr/src]# tail -4 /var/log/messages
> Feb  5 08:58:12 vbsd101 kernel: cdce0: <CDC Communications Control> on 
> usbus1
> Feb  5 08:58:12 vbsd101 kernel: ue0: <USB Ethernet> on cdce0
> Feb  5 08:58:12 vbsd101 kernel: ue0: Ethernet address: 64:d1:a3:31:81:80
> Feb  5 08:58:12 vbsd101 devd: Executing '/etc/pccard_ether ue0 start'
> 
> [root@vbsd101 /usr/src]# ifconfig ue0
> ue0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
> 	ether 64:d1:a3:31:81:80
> 	inet 192.168.5.200 netmask 0xffffff00 broadcast 192.168.5.255
> 	nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
> 
> How-ever there is no traffic possible and also no bulk requests are done.
> 
> 
> 
> Looking at the if_rue(4) and the linux r8152.c code, basically I got 
> this far in porting but yet no working code:
>      https://rickvanderzwet.nl/svn/personal/freebsd-rtl-driver/
> 
> There are no bulk out and in packets passing trough, so I am basically 
> stuck now, not knowing how-to continue this journey. Could anybody give 
> me an hint on how-to get this train going again?

Mine basically is working but needs serious cleanup and bug fixes.
http://people.freebsd.org/~kevlo/ure.diff

Please let me know if it works for you, thanks.

> Thanks in advance!
> /Rick

	Kevin



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAASDrVnob4A%2B5-4vHRw6sTAingq=CqNgsdACQHK_35Pdb=jZVg>