On 2007-01-28 12:24, [EMAIL PROTECTED] wrote: > Hi, > i am working on getting mythtv-0.20 talking to the pvrxxx driver. > > the problem appears when i want to do: > v4l2_capabilities vcap; > ioctl(videofd, VIDIOC_QUERYCAP, &vcap); > > the driver and mythtv have the struct differently aligned, and i get > an "inappropiate ioctl for device". this is what the struct + IOR look > like:
Welcome to the world of structure alignment issues :) > struct v4l2_capability > { > __u8 driver[16]; /* i.e. "bttv" */ > __u8 card[32]; /* i.e. "Hauppauge WinTV" */ > __u8 bus_info[32]; /* "PCI:" + pci_name(pci_dev) */ > __u32 version; /* should use KERNEL_VERSION() */ > __u32 capabilities; /* Device capabilities */ > __u32 reserved[4]; > }; > #define VIDIOC_QUERYCAP _IOR ('V', 0, struct v4l2_capability) > > the driver is compiled like this: > > cc -O -pipe -Werror -D_KERNEL -DKLD_MODULE -nostdinc -I- -I../../.. > -I. -I@ -I@/contrib/altq -I@/../include -finline-limit=8000 > -fno-common -fno-omit-frame-pointer -mcmodel=kernel -mno-red-zone > -mfpmath=387 -mno-sse -mno-sse2 -mno-mmx -mno-3dnow -msoft-float > -fno-asynchronous-unwind-tables -ffreestanding -Wall -Wredundant-decls > -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes > -Wpointer-arith -Winline -Wcast-qual -fformat-extensions -std=c99 -c > /usr/ports/multimedia/pvrxxx/work/modules/cxm/cxm/../../../dev/cxm/cxm.c > > it yields a struct-size of 104 bytes. > > mythtv is compiled like this: > > g++ -c -pipe -I/usr/local/include/artsc -D_REENTRANT > -I/usr/local/include/glib-2.0 -I/usr/local/lib/glib-2.0/include -g > -Wall -W -O2 -pthread -Wall -Wno-switch -fomit-frame-pointer > -I/usr/local/include/freetype2 -I/usr/local/include -DPIC -fPIC > -DUSING_FREEBOX -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 > -DPREFIX=\"/usr/local\" -DLIBDIR=\"/usr/local/lib\" > -D_LARGEFILE_SOURCE -DUSING_OSS -DUSING_H264TOOLS -DUSING_XV > -DUSING_FRONTEND -DUSING_CRC_IP_NETWORK_REC -DUSING_V4L -DUSING_DBOX2 > -DUSING_FREEBOX -DUSING_HDHOMERUN -DUSING_IVTV -DUSING_BACKEND > -DQT_NO_DEBUG -DQT_THREAD_SUPPORT -DQT_SHARED -DQT_TABLET_SUPPORT > -I/usr/local/share/qt/mkspecs/freebsd-g++ -I. > -I../../../../../../../local/include > -I../../../../../../../X11R6/include -I../.. -I.. -I../libmyth > -I../libavcodec -I../libavutil -I../libmythmpeg2 -Idvbdev -Impeg > -I../libmythlivemedia/BasicUsageEnvironment/include > -I../libmythlivemedia/groupsock/include > -I../libmythlivemedia/liveMedia/include > -I../libmythlivemedia/UsageEnvironment/include > -I../../../../../../../local/include -I/usr/X11R6/include -o > cardutil.o cardutil.cpp > > and it yields a struct-size of 128. > > is it the -std=c99? is it because this is on amd64? Most probably it's the -O2 flag, because -O2 enables -fstrict-aliasing on top of the usual -O optimizations. You can probably disable this per-structure, by using the special __packed macro for this structure when building both the kernel *and* userland structures. _______________________________________________ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"