Bug 275344 - RTL8192EU usb wifi, hostapd error
Summary: RTL8192EU usb wifi, hostapd error
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: wireless (show other bugs)
Version: 14.0-STABLE
Hardware: amd64 Any
: --- Affects Only Me
Assignee: freebsd-wireless (Nobody)
URL:
Keywords:
Depends on:
Blocks: 277512
  Show dependency treegraph
 
Reported: 2023-11-26 06:04 UTC by tamas.csabi
Modified: 2024-10-24 12:36 UTC (History)
3 users (show)

See Also:


Attachments
error-messages (7.38 KB, text/plain)
2023-11-26 06:04 UTC, tamas.csabi
no flags Details
/var/log/messages (56.81 KB, text/plain)
2023-11-29 16:13 UTC, tamas.csabi
no flags Details
hostapdd (5.21 KB, text/plain)
2023-11-29 16:23 UTC, tamas.csabi
no flags Details
usbdump (636.58 KB, text/plain)
2023-11-29 16:23 UTC, tamas.csabi
no flags Details
/var/log/messages_2 (72.89 KB, text/plain)
2023-11-29 16:27 UTC, tamas.csabi
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description tamas.csabi 2023-11-26 06:04:24 UTC
Created attachment 246572 [details]
error-messages

Hello everyone.
I ran into a problem, if someone could test it I would appreciate it:

System:
FreeBSD 14.0 - fresh install
USB wifi dongle - Realtek RTL8192EU

Modules:
rtwn
if_rtwn_usb

I configure the wlan0 interface:

ifconfig wlan0 create wlandev rtwn0 wlanmode hostap
ifconfig wlan0 inet 10.0.0.1 netmask 255.255.255.0 ssid FreeBSD-AP mode 11g channel 3 country HU

the interface works:
wlan0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        ether 77:bc:b5:1b:1c:96
        inet 10.0.0.1 netmask 0xffffff00 broadcast 10.0.0.255
        groups: wlan
        ssid FreeBSD-AP channel 3 (2422 MHz 11g) bssid 77:bc:b5:1b:1c:96
        regdomain ETSI country HU authmode OPEN privacy OFF txpower 30
        scanvalid 60 protmode CTS wme dtimperiod 1 -dfs
        parent interface: rtwn0
        media: IEEE 802.11 Wireless Ethernet autoselect mode 11g <hostap>
        status: running
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>

I'm setting up hostapd:

/etc/hostapd.conf:

ssid=FreeBSD-AP
interface=wlan0
channel=3
country_code=HU
ctrl_interface=/var/run/hostapd
hw_mode=g
wmm_enabled=1
logger_syslog=-1
logger_syslog_level=2
wpa=2
wpa_key_mgmt=WPA-PSK WPA-EAP
wpa_pairwise=TKIP CCMP
wpa_passphrase=PASSWORD

Hostapd starts:
At this moment, the dongle will stop and sends an error message that the usb device is not available.

The same configuration worked perfectly on 13.2 until now.
Reloading the modules doesn't make a difference either.
I will send the error messages
Thank you for your help.
Comment 1 Bjoern A. Zeeb freebsd_committer freebsd_triage 2023-11-29 01:59:06 UTC
Can you share the USB device_descr, e.g.:

usbconfig -d 0.9 dump_device_desc

(change -d 0.9 to the number for your rtwn);  possibly also the full usbconfig output listing all devices?

What is the exact error message?

We'll see if this is a USB or WiFi problem.


Just as a note so I don't forget -- in the future if needed --
Can you possibly also increase usb debugging changing the sysctl (from man 4 usb):

     hw.usb.debug
             Debug output level, where 0 is debugging disabled and larger
             values increase debug message verbosity.  Default is 0.
Comment 2 tamas.csabi 2023-11-29 16:13:28 UTC
Created attachment 246659 [details]
/var/log/messages
Comment 3 tamas.csabi 2023-11-29 16:22:21 UTC
(In reply to Bjoern A. Zeeb from comment #1)
Thanks for helping me, I appreciate it.
I will try to send everything.

% usbconfig -d 1.2 dump_device_desc
ugen1.2: <Realtek 802.11n NIC> at usbus1, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON (500mA)

bLength = 0x0012
bDescriptorType = 0x0001
bcdUSB = 0x0210
bDeviceClass = 0x0000  <Probed by interface class>
bDeviceSubClass = 0x0000
bDeviceProtocol = 0x0000
bMaxPacketSize0 = 0x0040
idVendor = 0x2357
idProduct = 0x0107
bcdDevice = 0x0200
iManufacturer = 0x0001  <Realtek >
iProduct = 0x0002  <802.11n NIC >
iSerialNumber = 0x0003  <00e04c000001>
bNumConfigurations = 0x0001

% usbconfig
ugen3.1: <ATI EHCI root HUB> at usbus3, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE (0mA)
ugen2.1: <ATI OHCI root HUB> at usbus2, cfg=0 md=HOST spd=FULL (12Mbps) pwr=SAVE (0mA)
ugen1.1: <ATI EHCI root HUB> at usbus1, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE (0mA)
ugen0.1: <ATI OHCI root HUB> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=SAVE (0mA)
ugen3.2: <APB610DX5 1.3M HD WebCam> at usbus3, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON (500mA)
ugen3.3: <Generic USB2.0-CRW> at usbus3, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON (500mA)
ugen1.2: <Realtek 802.11n NIC> at usbus1, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON (500mA)

messages.txt is from /var/log/messages.
usbdump.txt is the output of "usbdump -i usbus1 -f 2 -s 65536 -vvv" command.
hostap_dd.txt is the output of hostapd -dd /etc/hostapd.conf.
Comment 4 tamas.csabi 2023-11-29 16:23:10 UTC
Created attachment 246661 [details]
hostapdd
Comment 5 tamas.csabi 2023-11-29 16:23:52 UTC
Created attachment 246662 [details]
usbdump
Comment 6 tamas.csabi 2023-11-29 16:27:58 UTC
Created attachment 246663 [details]
/var/log/messages_2
Comment 7 Bjoern A. Zeeb freebsd_committer freebsd_triage 2023-11-29 16:35:26 UTC
(In reply to tamas.csabi from comment #5)

> "At this moment, the dongle will stop and sends an error message that the usb device is not available."

Can you help me sieving through all this by pointing out the specific error message it spits out?  I tried to see it in the messages but probably been blind.
Comment 8 tamas.csabi 2023-11-29 16:57:52 UTC
(In reply to Bjoern A. Zeeb from comment #7)

On the USB dongle, the flashing LED goes off and the following message is sent:

ugen1.2: <Realtek 802.11n NIC> at usbus1 (disconnected)
rtwn0: at uhub2, port 1, addr 2 (disconnected)
rtwn0: r92e_power_off: failed to block Tx queues
rtwn0: detached
usb_alloc_device: set address 2 failed (USB_ERR_IOERROR, ignored)
usbd_setup_device_desc: getting device descriptor at addr 2 failed, USB_ERR_IOERROR
usbd_req_re_enumerate: addr=2, set address failed! (USB_ERR_IOERROR, ignored)
usbd_setup_device_desc: getting device descriptor at addr 2 failed, USB_ERR_IOERROR
usbd_req_re_enumerate: addr=2, set address failed! (USB_ERR_IOERROR, ignored)
usbd_setup_device_desc: getting device descriptor at addr 2 failed, USB_ERR_IOERROR
usbd_req_re_enumerate: addr=2, set address failed! (USB_ERR_IOERROR, ignored)
usbd_setup_device_desc: getting device descriptor at addr 2 failed, USB_ERR_IOERROR
usbd_req_re_enumerate: addr=2, set address failed! (USB_ERR_IOERROR, ignored)
usbd_setup_device_desc: getting device descriptor at addr 2 failed, USB_ERR_IOERROR
uhub_reattach_port: could not allocate new device
Comment 9 Bjoern A. Zeeb freebsd_committer freebsd_triage 2023-11-30 22:13:55 UTC
Just as a note (related or unrelated but given I hadn't seen this before either).

I just tested rtwn sta and monitor and ended up in:

wlan113: link state changed to UP
rtwn0: device timeout
wlan113: link state changed to DOWN
firmware: 'rtwn-rtl8188eufw' version 111: 13904 bytes loaded at 0xffffffff82a9d000
xhci0: Resetting controller   
uhub0: at usbus0, port 1, addr 1 (disconnected)           
...

I believe this is likely an unrelated problem but also rtwn/usb.
Comment 10 abob 2023-12-06 18:51:24 UTC
I have the same problem.

Configuration ifconfig_wlan0="HOSTAP channel 1" - worked perfectly on FreeBSD 12.0-13.1.

But on 14.0 - system run endless loop:

kernel: rtwn0: MAC/BB RTL8812AU, RF 6052 2T2R
kernel: wlan0: Ethernet address: cc:95:d7:XX:XX:XX
kernel: ugen0.4: <Realtek 802.11n NIC> at usbus0 (disconnected)
kernel: rtwn0: at uhub1, port 3, addr 4 (disconnected)
kernel: rtwn0: r12a_power_off: could not turn off MAC
kernel: rtwn0: detached
...
Comment 11 tamas.csabi 2023-12-06 19:25:53 UTC
(In reply to abob from comment #10)
It also works perfectly for me on freebsd 13.2.
I recompiled the modules, installed another hostapd, but it doesn't work on 14.0.