Re: Raspberry Pi Zero W almost useless

Ramiro Aceves <[email protected]>
Newsgroups gmane.os.netbsd.ports.arm,gmane.os.netbsd.general
Message-ID <CANfMP74HN0fweWpjNphEo5NJ=DHBWMdSi8WbVHvjigv7yQiOBw@mail.gmail.com>
Hello,


I started playing  tweaking usbdevs file in the Intel Nuc 8i7BEH
NetBSD-10_RC3 amd64- I added the line:

product REALTEK RTL8188FTV      0xf179  RTL8188FTV

 then tried  adding a line in  if_urtwn.c file just to see what happened:


#define URTWN_DEV(v,p)  { { USB_VENDOR_##v, USB_PRODUCT_##v##_##p }, 0 }
#define URTWN_RTL8188E_DEV(v,p) \
        { { USB_VENDOR_##v, USB_PRODUCT_##v##_##p }, FLAG_RTL8188E }
#define URTWN_RTL8192EU_DEV(v,p) \
        { { USB_VENDOR_##v, USB_PRODUCT_##v##_##p }, FLAG_RTL8192E }
static const struct urtwn_dev {
        struct usb_devno        dev;
        uint32_t                flags;
#define FLAG_RTL8188E   __BIT(0)
#define FLAG_RTL8192E   __BIT(1)
} urtwn_devs[] = {
        URTWN_DEV(ABOCOM,       RTL8188CU_1),
...
...
        URTWN_DEV(REALTEK,      RTL8188FTV),
...
...
};
#undef URTWN_DEV
#undef URTWN_RTL8188E_DEV
#undef URTWN_RTL8192EU_DEV
...
...


Started kernel compilation and ended with error:

...
...

#   compile  MYKERNEL/if_urtwn.o
gcc -mcmodel=kernel -mno-red-zone -mno-mmx -mno-sse -mno-avx
-msoft-float -mindirect-branch=thunk -mindirect-branch-register
-ffreestanding -fno-zero-initialized-in-bss
-fno-delete-null-pointer-checks -g -O2 -fno-omit-frame-pointer
-fstack-protector -Wstack-protector --param ssp-buffer-size=1
-fstack-usage -Wstack-usage=3584 -fno-strict-aliasing -fno-common
-std=gnu99 -Werror -Wall -Wno-main -Wno-format-zero-length
-Wpointer-arith -Wmissing-prototypes -Wstrict-prototypes
-Wold-style-definition -Wswitch -Wshadow -Wcast-qual -Wwrite-strings
-Wno-unreachable-code -Wno-pointer-sign -Wno-attributes
-Wno-type-limits -Wextra -Wno-unused-parameter -Wold-style-definition
-Wno-sign-compare -Walloca -Wno-address-of-packed-member -Damd64
-Dx86_64 -I. -I../../../../external/mit/xen-include-public/dist/
-I../../../../external/bsd/libnv/dist
-I../../../../external/bsd/acpica/dist
-I../../../../../common/lib/libx86emu
-I../../../../../common/lib/libc/misc -I../../../../../common/include
-I../../../../arch -I../../../.. -nostdinc -DCOMPAT_UTILS
-D__XEN_INTERFACE_VERSION__=0x3020a -DCOMPAT_44 -D_KERNEL
-D_KERNEL_OPT -std=gnu99
-I../../../../lib/libkern/../../../common/lib/libc/quad
-I../../../../lib/libkern/../../../common/lib/libc/string
-I../../../../lib/libkern/../../../common/lib/libc/arch/x86_64/string
-I../../../../lib/libkern/../../../common/lib/libc/arch/x86_64/atomic
-I../../../../lib/libkern/../../../common/lib/libc/hash/sha3
-D_FORTIFY_SOURCE=2 -I../../../../external/isc/atheros_hal/dist
-I../../../../external/isc/atheros_hal/ic
-I../../../../../common/include
-I../../../../external/bsd/acpica/dist/include
-I../../../../external/bsd/libnv/dist -c
../../../../dev/usb/if_urtwn.c -o if_urtwn.o
../../../../dev/usb/if_urtwn.c:122:44: error:
'USB_PRODUCT_REALTEK_RTL8188FTV' undeclared here (not in a function);
did you mean 'USB_PRODUCT_REALTEK_RTL8188CTV'?
  122 | #define URTWN_DEV(v,p) { { USB_VENDOR_##v, USB_PRODUCT_##v##_##p }, 0 }
      |                                            ^~~~~~~~~~~~
../../../../dev/usb/if_urtwn.c:187:2: note: in expansion of macro 'URTWN_DEV'
  187 |  URTWN_DEV(REALTEK, RTL8188FTV),
      |  ^~~~~~~~~
../../../../dev/usb/if_urtwn.c:187:2: error: missing initializer for
field 'ud_product' of 'struct usb_devno'
[-Werror=missing-field-initializers]
In file included from ../../../../dev/usb/if_urtwn.c:72:
../../../../dev/usb/usbdi.h:234:11: note: 'ud_product' declared here
  234 |  uint16_t ud_product;
      |           ^~~~~~~~~~
cc1: all warnings being treated as errors
*** Error code 1

Stop.
make: stopped in /usr/src/sys/arch/amd64/compile/MYKERNEL
      303.39 real       258.65 user        27.95 sys
netbsd-nuc#



soon realized that usbdevs.h file was not automatically updated as I
thought and I did not found the #define line of the chip I added in
usbdevs file.

Reading usbdevs.h said that make -f Makefile.usbdevs should be executed:

netbsd-nuc# cd /usr/src/sys/dev/usb
netbsd-nuc# make -f Makefile.usbdevs
/bin/rm -f usbdevs.h usbdevs_data.h
/usr/src/tooldir.NetBSD-10.0_RC3-amd64/bin/nbawk -f
/usr/src/sys/dev/usb/../devlist2h.awk usbdevs
make: exec(/usr/src/tooldir.NetBSD-10.0_RC3-amd64/bin/nbawk) failed
(No such file or directory)
*** Error code 1

Stop.
make: stopped in /usr/src/sys/dev/usb
netbsd-nuc#

I am stuck now. Perhaps should I build everything, userland and
kernel? I think I am missing many things  :-(

Thanks.
Ramiro.

El mié, 7 feb 2024 a las 19:21, Rhialto (<[email protected]>) escribió:
>
> On Wed 07 Feb 2024 at 10:44:04 +0100, Ramiro Aceves wrote:
> > The problem is to change /usr/src/dev/usb/if_urtwn.c  without knowing
> > what I am exactly  doing  ;-)
>
> I don't know either, but I spot a list of these USB ids (starting with
>
> } urtwn_devs[] = {
>         URTWN_DEV(ABOCOM,       RTL8188CU_1),
>         URTWN_DEV(ABOCOM,       RTL8188CU_2),
> ). You could add yours to the list (it has 3 parts so maybe you have to
> apply some guesswork in which part it fits best). If you're lucky and
> your interface isn't too different from the others, then it might work.
>
> > Ramiro
> -Olaf.
> --
> ___ Olaf 'Rhialto' Seibert                            <rhialto/at/falu.nl>
> \X/ There is no AI. There is just someone else's work.           --I. Rose
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.