nvidia-shield-controller-driver icon indicating copy to clipboard operation
nvidia-shield-controller-driver copied to clipboard

Not working on ath9k-htc (usb) devices

Open webgeek1234 opened this issue 8 years ago • 12 comments

Can I get some more info on how you got this to work? I'm trying to replicate it on Fedora 24 with no luck. I can create the ago interface and start the pairing, but the light continues blinking and wpa_cli loops the following messages:

<3>CTRL-EVENT-EAP-STARTED ${macaddr} <3>CTRL-EVENT-EAP-PROPOSED-METHOD vendor=0 method=1

System Info: OS: Fedora 24 x86_64 WiFi card: Think Penguin TPE-N150USB (Atheros AR9271) wpa_supplicant: wpa_supplicant-2.5-5.fc24.x86_64

I'm trying to get this working manually, then I'll be poking at a userspace program to handle the pairing and ozwpan configuration (via the ioctl interface) automatically. There's also a lot that could be done with the blake interface to get battery info and such. The SHIELD stock Android roms contain two cli programs (blake and lota) that handle controller status and firmware updates respectively. Should be possible to sniff those and fold them into a userspace driver.

webgeek1234 avatar Oct 01 '16 20:10 webgeek1234

So for me it looks like this

<3>WPS-PBC-ACTIVE
<3>CTRL-EVENT-EAP-STARTED 00:04:4b:21:4a:f8
<3>CTRL-EVENT-EAP-PROPOSED-METHOD vendor=0 method=1
<3>CTRL-EVENT-EAP-STARTED 00:04:4b:21:4a:f8
<3>CTRL-EVENT-EAP-PROPOSED-METHOD vendor=0 method=1
<3>CTRL-EVENT-EAP-PROPOSED-METHOD vendor=14122 method=254
<3>WPS-REG-SUCCESS 00:04:4b:21:4a:f8 f53e5a2c-604c-483f-9256-00044b214af8
<3>WPS-PBC-DISABLE
<3>WPS-SUCCESS

Maybe just retry by first removing the ago interface and then adding a new one. For me the pairing also doesn't always work reliably. FYI, I'm also using wpa_supplicant 2.5.

With respect to pairing: With wpa_suplicant, you could do this using the DBUS interface of wpa_supplicant. I'm working on extending a python wrapper for it here: https://github.com/devmapal/python-wpa-supplicant. I intend use this to write a userspace app in python for pairing the controller.

As far as I can tell, the blake interface is a userspace USB driver implementation. The trace here https://github.com/devmapal/nvidia-shield-controller-driver/tree/master/packet-capture-files/handshake includes some vendor defined USB device descriptors which I assume are used to transfer things like the battery level.

devmapal avatar Oct 01 '16 20:10 devmapal

I've cycled the p2p group several times, no change. And tried a couple different controllers. Which distro are you using? I just tried Fedora 23 on another computer and it does the same thing. I'd like to try a similar baseline to see if I'm doing something wrong or if there's a software difference somewhere.

DBUS would make the wpa_supplicant part easier, most likely. Personally never been much of a python fan, though. We may end up working in parallel, not that that's a bad thing. I'm also wanting to use the experience to write an open source pairing app for Android. Currently, it's impossible to use the stock app on custom ROMs.

webgeek1234 avatar Oct 01 '16 22:10 webgeek1234

I'm running gentoo, with an Intel Dualband-Wireless-AC 7260 as the wifi adapter.

I'll see if I can find someone running fedora so I can try it out myself.

devmapal avatar Oct 01 '16 22:10 devmapal

Fedora has Live DVDs that should have enough to do initial pairing. I'm going to pull the Gentoo Live DVD and see what happens. Though, knowing the nature of Gentoo, how can they have a live environment? shrugs

webgeek1234 avatar Oct 01 '16 22:10 webgeek1234

Cool, I'll try the Fedora Live DVD.

Yeah, I always used a Ubuntu Live CD to install my gentoo systems, much nicer than with the Gentoo live DVD ;-)

devmapal avatar Oct 01 '16 22:10 devmapal

Tried the Gentoo live dvd, but its wpa_supplicant didn't have p2p support. Tried Arch after that since it's supposed to be fairly similar, but prebuilt. That acted similar to what Fedora was doing. I'll probably try and see if I can emerge a wpa_supplicant with p2p support sometime later, but dunno if the Gentoo live environment will let me. This shouldn't be so difficult, though... I've got to be missing something simple.

webgeek1234 avatar Oct 02 '16 01:10 webgeek1234

The fedora live dvd would not boot for me, but I managed to get the Arch live cd to run. Using that, I was able to pair my controller. Maybe it is related to the driver of your wireless adapter. You could try running wpa_supplicant with the -dd flags to get more verbose logging. Maybe that yields some insights.

devmapal avatar Oct 02 '16 11:10 devmapal

Yeah, I'm beginning to suspect the wireless driver myself. I bought a card with an Atheros chip for this because those normally have top notch support everywhere. I'll have to look around and see if there's any open bug reports. Or possibly compile a manufacturer driver. But unfortunately I don't have another card to test with, had to buy this one to even start playing with it. Maybe I'll get Ubuntu booting on the tablet again and see what I can do there.

webgeek1234 avatar Oct 02 '16 14:10 webgeek1234

Picked up an ath9k pci-e card and this is working as expected now. The ath9k-htc (usb devices) firmware appears to have a p2p-go bug.

Haven't tried audio output yet, but mic input is delayed by like a second and a half to two seconds. Possibly a pulse configuration issue, but my hardwired mic is virtually real time. Maybe something to look at to add to the readme.

I'll be tinkering with this more in the coming days. Thanks for the help. Looking forward to seeing ozwpan mainlined again.

webgeek1234 avatar Oct 23 '16 02:10 webgeek1234

Happy to hear that it is working for you now. I haven't yet tried audio input myself, will do so and see if I also get such a delay.

devmapal avatar Oct 23 '16 06:10 devmapal

Really need to find a better way to communicate, instead of misusing issues.

https://github.com/CyanogenMod/android_kernel_nvidia_shield/blob/cm-13.0/drivers/hid/hid-nvidia-blake.c

Have you seen this? Controls at least some stuff for the touchpad. One of the changes in the history disables the touchpad by default, but mentions that it can be toggled via userspace. That woukd be useful. Also interesting is:

https://github.com/CyanogenMod/android_kernel_nvidia_shield/commit/cb32311b8c65dbd1cb2576ef8da408bee151cba0

Force feedback support. That isn't initializing right now by default. Dunno if it's due to the controller not using standard hid ffb or something else. I'll poke around at that a bit more.

I've only glanced through the driver code. Don't know if any of that is really needed. Might be nice to clean up and submit, though.

webgeek1234 avatar Oct 25 '16 02:10 webgeek1234

Hi, I suggest we try to use the #ozwpan channel on freenode.

Cool, I was not aware of the driver in CyanogenMod. While this does not replace the ozwpan driver, it should allow to use the touchpad. With the default hid driver that ships with linux, the touchpad is behaving quite weird. Will try it out once I find the time to.

devmapal avatar Oct 27 '16 07:10 devmapal