albfan / miraclecast

Connect external monitors to your system via Wifi-Display specification also known as Miracast
Other
3.84k stars 413 forks source link

ignored device: wlan0 (Qualcomm Atheros - QCA9377) #303

Closed QuadTriangle closed 6 years ago

QuadTriangle commented 6 years ago
./test-hardware-capabilities.sh
wlan0 supports P2P

I am trying it for some time. I don't know what is wrong on my side.

after enabling trace with sudo miracle-wifid --log-level trace:

INFO: miracle-wifid - revision 1.0 Nov  7 2018 13:45:26
DEBUG: friendly-name from local hostname: XXX (manager_read_name() in ../../../src/wifi/wifid.c:388)
DEBUG: link: new link: wlan0 (3) (link_new() in ../../../src/wifi/wifid-link.c:71)
DEBUG: supplicant: new supplicant for wlan0 (supplicant_new() in ../../../src/wifi/wifid-supplicant.c:2103)
INFO: link: add link: wlan0
DEBUG: ignored device: wlan0 (manager_add_udev_link() in ../../../src/wifi/wifid.c:122)

so, I modified the logic in wifid.c, now It shows:

sudo ./miracle-wifid --log-level trace
INFO: miracle-wifid - revision 1.0 Nov  7 2018 13:52:28
DEBUG: friendly-name from local hostname: XXX (manager_read_name() in ../../../src/wifi/wifid.c:388)
DEBUG: link: new link: wlan0 (3) (link_new() in ../../../src/wifi/wifid-link.c:71)
DEBUG: supplicant: new supplicant for wlan0 (supplicant_new() in ../../../src/wifi/wifid-supplicant.c:2103)
INFO: link: add link: wlan0
INFO: link: manage link wlan0
DEBUG: supplicant: start supplicant of wlan0 (supplicant_start() in ../../../src/wifi/wifid-supplicant.c:2628)
DEBUG: supplicant: spawn supplicant of wlan0 (supplicant_spawn() in ../../../src/wifi/wifid-supplicant.c:2478)
INFO: supplicant: wpa_supplicant found: /usr/sbin/wpa_supplicant
INFO: supplicant: wpas spawned as pid:10275
DEBUG: supplicant: open supplicant of wlan0 (supplicant_open() in ../../../src/wifi/wifid-supplicant.c:2269)
TRACE: wpa: raw message: OK

TRACE: wpa: raw message: OK

TRACE: wpa: raw message: p2p_device_address=94:53:30:ad:34:5d
p2p_state=IDLE
wifi_display=1
ifname=p2p-dev-wlan0
address=94:53:30:ad:34:5d
ifname=wlan0
address=94:53:30:ad:34:5d

DEBUG: supplicant: local p2p-address is: 94:53:30:ad:34:5d (supplicant_status_fn() in ../../../src/wifi/wifid-supplicant.c:1823)
TRACE: wpa: raw message: OK

TRACE: wpa: raw message: OK

TRACE: wpa: raw message: FAIL

TRACE: wpa: raw message: OK

TRACE: wpa: raw message: FAIL

DEBUG: supplicant: send 'WFD_SUBELEM_SET 0 000600111c4400c8' to wpas on wlan0 (supplicant_set_wfd_subelements() in ../../../src/wifi/wifid-supplicant.c:1991)
TRACE: wpa: raw message: OK

DEBUG: supplicant: sent P2P_FIND to wpas on wlan0 (supplicant_p2p_start_scan() in ../../../src/wifi/wifid-supplicant.c:2036)
TRACE: wpa: raw message: OK

DEBUG: supplicant: p2p-scanning now active on wlan0 (supplicant_p2p_find_fn() in ../../../src/wifi/wifid-supplicant.c:1917)
TRACE: wpa: raw message: IFNAME=p2p-dev-wlan0 <3>CTRL-EVENT-SCAN-STARTED 
TRACE: wpa: raw message: <3>CTRL-EVENT-SCAN-STARTED 
TRACE: wpa: raw message: <3>P2P-DEVICE-FOUND 9e:8c:6e:52:67:cc p2p_dev_addr=9e:8c:6e:52:67:cc pri_dev_type=7-0050F204-1 name='[TV] Samsung 5 Series (32)' config_methods=0x188 dev_capab=0x25 group_capab=0x0 wfd_dev_info=0x01131c440036 vendor_elems=1 new=1
TRACE: wpa: raw message: <3>P2P-DEVICE-FOUND 9e:8c:6e:52:67:cc p2p_dev_addr=9e:8c:6e:52:67:cc pri_dev_type=7-0050F204-1 name='[TV] Samsung 5 Series (32)' config_methods=0x188 dev_capab=0x25 group_capab=0x0 wfd_dev_info=0x01131c440036 vendor_elems=1 new=1
DEBUG: peer: new peer: 9e:8c:6e:52:67:cc @ wlan0 (peer_new() in ../../../src/wifi/wifid-peer.c:52)
INFO: peer: add peer: 9e:8c:6e:52:67:cc
DEBUG: peer: peer 9e:8c:6e:52:67:cc @ wlan0 started (peer_supplicant_started() in ../../../src/wifi/wifid-peer.c:162)
DEBUG: supplicant: requesting data for new peer 9e:8c:6e:52:67:cc (supplicant_event_p2p_device_found() in ../../../src/wifi/wifid-supplicant.c:962)
TRACE: wpa: raw message: IFNAME=wlan0 <3>CTRL-EVENT-BSS-ADDED 0 c4:71:54:2d:0c:44
TRACE: wpa: raw message: IFNAME=wlan0 <3>CTRL-EVENT-BSS-ADDED 1 78:44:76:7f:8f:f0
TRACE: wpa: raw message: IFNAME=wlan0 <3>CTRL-EVENT-BSS-ADDED 2 c4:6e:1f:b6:73:fa
TRACE: wpa: raw message: IFNAME=wlan0 <3>CTRL-EVENT-BSS-ADDED 3 f4:f2:6d:8c:0f:a2
TRACE: wpa: raw message: IFNAME=wlan0 <3>CTRL-EVENT-BSS-ADDED 4 0c:80:63:5b:a7:8c
TRACE: wpa: raw message: IFNAME=wlan0 <3>CTRL-EVENT-BSS-ADDED 5 e8:de:27:91:0d:e4
TRACE: wpa: raw message: IFNAME=wlan0 <3>CTRL-EVENT-BSS-ADDED 6 70:4f:57:ec:c9:e8
TRACE: wpa: raw message: IFNAME=wlan0 <3>CTRL-EVENT-BSS-ADDED 7 f4:f2:6d:2a:84:e2
TRACE: wpa: raw message: IFNAME=wlan0 <3>CTRL-EVENT-BSS-ADDED 8 ec:08:6b:28:6a:5c
TRACE: wpa: raw message: 9e:8c:6e:52:67:cc
pri_dev_type=7-0050F204-1
device_name=[TV] Samsung 5 Series (32)
manufacturer=SAMSUNG_ELECTRONICS
model_name= 
model_number= 
serial_number= 
config_methods=0x188
dev_capab=0x25
group_capab=0x0
level=-48
age=5
listen_freq=2457
wps_method=not-ready
interface_addr=00:00:00:00:00:00
member_in_go_dev=00:00:00:00:00:00
member_in_go_iface=00:00:00:00:00:00
go_neg_req_sent=0
go_state=unknown
dialog_token=0
intended_addr=00:00:00:00:00:00
country=__
oper_freq=0
req_config_methods=0x0
flags=[REPORTED]
status=0
invitation_reqs=0
wfd_subelems=00000601131c440036
vendor_elems=dd080000f00c00000103dd1a0000f00f000206010310030e01039c8c6e5267cd9c8c6e5267cd

TRACE: wpa: raw message: IFNAME=p2p-dev-wlan0 <3>CTRL-EVENT-SCAN-STARTED 
TRACE: wpa: raw message: <3>CTRL-EVENT-SCAN-STARTED 
TRACE: wpa: raw message: IFNAME=p2p-dev-wlan0 <3>CTRL-EVENT-SCAN-STARTED 
TRACE: wpa: raw message: <3>CTRL-EVENT-SCAN-STARTED 
TRACE: wpa: raw message: IFNAME=p2p-dev-wlan0 <3>CTRL-EVENT-SCAN-STARTED 
TRACE: wpa: raw message: <3>CTRL-EVENT-SCAN-STARTED 
TRACE: wpa: raw message: IFNAME=wlan0 <3>CTRL-EVENT-BSS-ADDED 9 04:95:e6:58:8c:a0
TRACE: wpa: raw message: IFNAME=wlan0 <3>CTRL-EVENT-BSS-ADDED 10 ec:08:6b:6e:f1:82
TRACE: wpa: raw message: IFNAME=p2p-dev-wlan0 <3>CTRL-EVENT-SCAN-STARTED 
TRACE: wpa: raw message: <3>CTRL-EVENT-SCAN-STARTED 
TRACE: wpa: raw message: IFNAME=p2p-dev-wlan0 <3>CTRL-EVENT-SCAN-STARTED 
TRACE: wpa: raw message: <3>CTRL-EVENT-SCAN-STARTED 
TRACE: wpa: raw message: IFNAME=p2p-dev-wlan0 <3>CTRL-EVENT-SCAN-STARTED 
TRACE: wpa: raw message: <3>CTRL-EVENT-SCAN-STARTED 
TRACE: wpa: raw message: IFNAME=p2p-dev-wlan0 <3>CTRL-EVENT-SCAN-STARTED 

Now, I can connect to the tv, but nothing happens:

sudo ./miracle-sinkctl           
[ADD] Link: 3
[miraclectl] # run 3
now running on link 3
[ADD] Peer: 9e:8c:6e:52:67:cc@3
[miraclectl] # list
  LINK INTERFACE                FRIENDLY-NAME                  MANAGED   
     3 wlan0                    <unknown>                      yes       

  LINK PEER-ID                  FRIENDLY-NAME                  CONNECTED 
     3 9e:8c:6e:52:67:cc@3      [TV] Samsung 5 Series (32)     no  
sudo ./miracle-wifictl           
[ADD] Link: 3
[ADD] Peer: 9e:8c:6e:52:67:cc@3
[miraclectl] # connect 9e:8c:6e:52:67:cc
[miraclectl] # list
  LINK INTERFACE                FRIENDLY-NAME                  MANAGED   
     3 wlan0                    <unknown>                      yes       

  LINK PEER-ID                  FRIENDLY-NAME                  CONNECTED 
     3 9e:8c:6e:52:67:cc@3      [TV] Samsung 5 Series (32)     no

tv ask for my permission to add, I accepted. now, whenever I use connect 9e:8c:6e:52:67:cc, tv shows Miracle connected to the tv.

Now, my question is, How can I use my tv as an external monitor?

On, windows 10, I press Fn+F8, select tv name. It works without disabling wifi connected.

albfan commented 6 years ago

See #172. Using miraclecast as source is still a WIP

QuadTriangle commented 6 years ago

@albfan How about DEBUG: ignored device: wlan0 (manager_add_udev_link() in ../../../src/wifi/wifid.c:122)

I had to diable some line to get it working.


#ifdef RELY_UDEV
        // if (udev_device_has_tag(d, "miracle") && !lazy_managed)
            link_set_managed(l, true);
        // else
            // link_set_managed(l, false);
#else
        // if ((!interface_name || !strcmp(interface_name, ifname)) && !lazy_managed) {
            link_set_managed(l, true);
        // } else {
            // log_debug("ignored device: %s", ifname);
        // }
albfan commented 6 years ago

print out values for lazy_managed and interface_name.

As you are not passing --lazy-managed nor -i <interface-name> you cannot go to else, but you do, let's see what happens

QuadTriangle commented 6 years ago

I used ../configure --enable-rely-udev. udev rules didn't work somehow. I tried rebooting. I will figure it out.

FYI: sudo tee "${RULE_FILE}" &>/dev/null <<-EOF is enough. cat is useless and causes hanging.

albfan commented 6 years ago

Then if you rely on udev but do not tag your device it is ignored

cat is useless about what?

QuadTriangle commented 6 years ago

In res/write-udev-rule.sh you have used cat | sudo tee "${RULE_FILE}" &>/dev/null <<-EOF. according to comments of https://stackoverflow.com/a/20752440, the use of cat is useless, here. that's why it hangs and user has to press an extra enter to exit. I can confirm it works without cat |