------------------------------------------------ dwmw2intel 2010-07-12 02:36:05 PDT 'iwlist scan' doesn't work very often; most of the time it just does this: ioctl(3, SIOCGIWSCAN, 0xbffe6cf8) = -1 EAGAIN (Resource temporarily unavailable) select(0, [], NULL, NULL, {0, 100000}) = 0 (Timeout) ioctl(3, SIOCGIWSCAN, 0xbffe6cf8) = -1 EAGAIN (Resource temporarily unavailable) select(0, [], NULL, NULL, {0, 100000}) = 0 (Timeout) ioctl(3, SIOCGIWSCAN, 0xbffe6cf8) = -1 E2BIG (Argument list too long) ioctl(3, SIOCGIWSCAN, 0xbffe6cf8) = -1 E2BIG (Argument list too long) ioctl(3, SIOCGIWSCAN, 0xbffe6cf8) = -1 E2BIG (Argument list too long) ioctl(3, SIOCGIWSCAN, 0xbffe6cf8) = -1 E2BIG (Argument list too long) ioctl(3, SIOCGIWSCAN, 0xbffe6cf8) = -1 E2BIG (Argument list too long) ioctl(3, SIOCGIWSCAN, 0xbffe6cf8) = -1 E2BIG (Argument list too long) mmap2(NULL, 266240, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb787d000 brk(0x90cf000) = 0x90cf000 ioctl(3, SIOCGIWSCAN, 0xbffe6cf8) = -1 E2BIG (Argument list too long) mremap(0xb787d000, 266240, 528384, MREMAP_MAYMOVE) = 0xb77fc000 ioctl(3, SIOCGIWSCAN, 0xbffe6cf8) = -1 E2BIG (Argument list too long) mremap(0xb77fc000, 528384, 1052672, MREMAP_MAYMOVE) = 0xb76fb000 ioctl(3, SIOCGIWSCAN, 0xbffe6cf8) = -1 E2BIG (Argument list too long) mremap(0xb76fb000, 1052672, 2101248, MREMAP_MAYMOVE) = 0xb74fa000 ioctl(3, SIOCGIWSCAN, 0xbffe6cf8) = -1 E2BIG (Argument list too long) mremap(0xb74fa000, 2101248, 4198400, MREMAP_MAYMOVE) = 0xb70f9000 ioctl(3, SIOCGIWSCAN, 0xbffe6cf8) = -1 E2BIG (Argument list too long) mremap(0xb70f9000, 4198400, 8392704, MREMAP_MAYMOVE) = 0xb68f8000 ioctl(3, SIOCGIWSCAN, 0xbffe6cf8) = -1 E2BIG (Argument list too long) mremap(0xb68f8000, 8392704, 16781312, MREMAP_MAYMOVE) = 0xb58f7000 ioctl(3, SIOCGIWSCAN, 0xbffe6cf8) = -1 E2BIG (Argument list too long) mremap(0xb58f7000, 16781312, 33558528, MREMAP_MAYMOVE) = 0xb38f6000 ioctl(3, SIOCGIWSCAN, 0xbffe6cf8) = -1 E2BIG (Argument list too long) mremap(0xb38f6000, 33558528, 67112960, MREMAP_MAYMOVE) = 0xaf8f5000 ioctl(3, SIOCGIWSCAN, 0xbffe6cf8) = -1 E2BIG (Argument list too long) mremap(0xaf8f5000, 67112960, 134221824, MREMAP_MAYMOVE) = 0xa78f4000 ioctl(3, SIOCGIWSCAN, 0xbffe6cf8) = -1 E2BIG (Argument list too long) mremap(0xa78f4000, 134221824, 268439552, MREMAP_MAYMOVE) = 0x978f3000 ioctl(3, SIOCGIWSCAN, 0xbffe6cf8) = -1 E2BIG (Argument list too long) mremap(0x978f3000, 268439552, 536875008, MREMAP_MAYMOVE) = 0x778f2000 ioctl(3, SIOCGIWSCAN, 0xbffe6cf8) = -1 E2BIG (Argument list too long) mremap(0x778f2000, 536875008, 1073745920, MREMAP_MAYMOVE) = 0x378f1000 ioctl(3, SIOCGIWSCAN, 0xbffe6cf8) = -1 E2BIG (Argument list too long) mremap(0x378f1000, 1073745920, 2147487744, MREMAP_MAYMOVE) = -1 ENOMEM (Cannot allocate memory) mmap2(NULL, 2147487744, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = -1 ENOMEM (Cannot allocate memory) mmap2(NULL, 2147618816, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = -1 ENOMEM (Cannot allocate memory) mmap2(NULL, 2097152, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0) = 0xb76be000 munmap(0xb76be000, 270336) = 0 munmap(0xb7800000, 778240) = 0 mprotect(0xb7700000, 135168, PROT_READ|PROT_WRITE) = 0 mmap2(NULL, 2147487744, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = -1 ENOMEM (Cannot allocate memory) munmap(0x378f1000, 1073745920) = 0 write(2, "print_scanning_info: Allocation "..., 39print_scanning_info: Allocation failed ) = 39 close(3) = 0 exit_group(0) = ? -------------------------------------------------------------- dwmw2intel 2010-07-12 02:36:44 PDT [ 4.173017] iwlagn: Intel(R) Wireless WiFi Link AGN driver for Linux, 2.6.33.5-23.1-netbook-k [ 4.173025] iwlagn: Copyright(c) 2003-2009 Intel Corporation [ 4.173186] iwlagn 0000:09:00.0: enabling device (0104 -> 0106) [ 4.173227] iwlagn 0000:09:00.0: PCI INT A -> GSI 18 (level, low) -> IRQ 18 [ 4.173313] iwlagn 0000:09:00.0: setting latency timer to 64 [ 4.173422] iwlagn 0000:09:00.0: Detected Intel Wireless WiFi Link 5300AGN REV=0x24 [ 4.196231] iwlagn 0000:09:00.0: Tunable channels: 13 802.11bg, 24 802.11a channels [ 4.196552] iwlagn 0000:09:00.0: irq 30 for MSI/MSI-X [ 3754.354641] iwlagn 0000:09:00.0: restoring config space at offset 0xf (was 0x100, writing 0x10b) [ 3754.354709] iwlagn 0000:09:00.0: restoring config space at offset 0x4 (was 0x4, writing 0xf0100004) [ 3754.354747] iwlagn 0000:09:00.0: restoring config space at offset 0x3 (was 0x0, writing 0x8) [ 3754.354787] iwlagn 0000:09:00.0: restoring config space at offset 0x1 (was 0x100000, writing 0x100106) [ 3755.503129] iwlagn 0000:09:00.0: RF_KILL bit toggled to enable radio. [ 6244.538332] iwlagn 0000:09:00.0: firmware: requesting iwlwifi-5000-2.ucode [ 6244.590573] iwlagn 0000:09:00.0: loaded firmware version 8.24.2.12 ----------------------------------------------------------------------- dwmw2intel 2010-07-12 03:50:09 PDT I believe the issue is caused by the number of available networks exceeding the kernel's buffer size.
dwmw2's analysis is almost certainly correct. Unfortunately, it is a limitation of the wireless extensions API. The alternative is to use the nl80211 API, embodied in the iw command: iw dev wlan0 scan trigger iw dev wlan0 scan dump
Yeah, I'd already fixed ConnMan and wpa_supplicant in my MeeGo build to use nl80211 (and fall back to wext for the benefit of crappy drivers).