ASRock ION 330HT nettop running Sabayon Linux [Solved]

Issues Related to Hardware (Sound, Video, Printers, Scanners, Webcams, Touchpads, Keyboards, Sensors, Drives, GRUB, etc.)

Moderator: Moderators

Fitzcarraldo
Sagely Hen
Posts: 8200
Joined: Sat Mar 10, 2007 5:40
Location: United Kingdom
Contact:

ASRock ION 330HT nettop running Sabayon Linux [Solved]

Post by Fitzcarraldo » Fri Mar 19, 2010 16:03

Just bought an ASRock ION 330HT nettop for my media centre project.

http://www.asrock.com/nettop/photo/ION% ... rge%29.jpg[/img2]

Image

Specification of the model I bought:

CPU - Intel® Atom™ 330 1.6GHz (Dual core) - can run 32-bit OS and 64-bit OS
OS - None loaded; user has to install OS of choice
Chipset - NVIDIA® ION™ graphics processor
Memory - Support DDR2 800MHz, 2 x SO-DIMM slots, default 2GB (2 x 1GB), Maximum up to 4GB
VGA - NVIDIA® ION™ Graphics, support DX10 / Full HD 1080p
HDD - 320GB 2.5" HDD, capable to support RAID 0, 1 by adopting the 2nd 2.5" HDD
ODD - DVD Super Multi R/W
I/O - 1 x HDMI, 1 x D-Sub VGA, 6 x USB 2.0, 1 x S/PDIF, 1 x Powered eSATA/USB*
*For Powered eSATA function, Hot Plug function is supported in RAID / AHCI mode only. IDE mode does not support Hot Plug function.
LAN - Gigabit Ethernet
WiFi - 802.11 b/g/n wireless LAN
Sound - 7.1 Ch HD Audio with DTS
System Acoustic - Below 26dB
Remote Controller - MCE Remote Controller
Power Unit - 65W/19V Adapter
Dimension - 195mm(W) x 70mm(H) x 186mm(L)
Volume (litres) - 2.5L
Weight - 1.7Kg

The only problem I had was that the optical drive would not open: I loosened the two screws holding the removable top of the nettop and slid back the lid just a fraction, as the lid was squeezing the drive door. Now the drive door opens fine.

The VGA socket is recessed, so the VGA plug of the cable from my monitor cannot be plugged in far enough to screw in the two retaining screws on the plug, and is hanging on by a thread. I'll have to buy an extender:

Image

Anyway, I booted an SL 4.2 KDE x86_64 LiveDVD and everything worked: VGA (automatically detected the resolution of my external monitor); Ethernet; WiFi; audio; USB keyboard; USB mouse. Both KDE Desktop Effects and Compiz worked perfectly.

Then I booted an SL 5.1-r1 KDE x86 LiveDVD and everything also worked: VGA (automatically detected the resolution of my external monitor); Ethernet; WiFi; audio; USB keyboard; USB mouse. KDE Desktop Effects also work perfectly. (No Compiz installed on the SL 5.1-r1 LiveDVD, so I didn't try Compiz.)

I then ran the installer and installed SL 5.1-r1 to the HDD. I used the installer to create manually 4 primary partitions: swap (circa 2048 Mb), /boot (circa 100 Mb), / (circa 61440 Mb), /home (the rest of the disk):

Code: Select all

# fdisk -l

Disk /dev/sda: 320.1 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xfb77a217

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14        7846    62918572+  83  Linux
/dev/sda3            7847        8107     2096482+  82  Linux swap / Solaris
/dev/sda4            8108       38913   247449195   83  Linux

Code: Select all

# df
Filesystem           1K-blocks      Used Available Use% Mounted on
rootfs                58981808   4841912  52881528   9% /
/dev/sda2             58981808   4841912  52881528   9% /
rc-svcdir                 1024       136       888  14% /lib/rc/init.d
udev                     10240       248      9992   3% /dev
/dev/shm                903548        88    903460   1% /dev/shm
/dev/sda4            231966632    409520 226608132   1% /home
/dev/sda1               101086     18215     80784  19% /boot
After installation, everything works. I'm typing this on the nettop and listening to an Audio CD as I type. There is an annoying pop from the external speakers when audio starts, so I'll have to tweak the audio configuration.

NVIDIA X Server Settings appears to work correctly. So far I have tried XBMC, Amarok and VLC and they work fine. Online YouTube Flash videos work fine too.

Anyway, if anyone is looking for a nettop that works with SL, this one does the job. If I find any limitations or problems in future I'll post here.

Code: Select all

# lspci
00:00.0 Host bridge: nVidia Corporation MCP79 Host Bridge (rev b1)
00:00.1 RAM memory: nVidia Corporation MCP79 Memory Controller (rev b1)
00:03.0 ISA bridge: nVidia Corporation MCP79 LPC Bridge (rev b2)
00:03.1 RAM memory: nVidia Corporation MCP79 Memory Controller (rev b1)
00:03.2 SMBus: nVidia Corporation MCP79 SMBus (rev b1)
00:03.3 RAM memory: nVidia Corporation MCP79 Memory Controller (rev b1)
00:03.5 Co-processor: nVidia Corporation MCP79 Co-processor (rev b1)
00:04.0 USB Controller: nVidia Corporation MCP79 OHCI USB 1.1 Controller (rev b1)
00:04.1 USB Controller: nVidia Corporation MCP79 EHCI USB 2.0 Controller (rev b1)
00:08.0 Audio device: nVidia Corporation MCP79 High Definition Audio (rev b1)
00:09.0 PCI bridge: nVidia Corporation MCP79 PCI Bridge (rev b1)
00:0a.0 Ethernet controller: nVidia Corporation MCP79 Ethernet (rev b1)
00:0b.0 IDE interface: nVidia Corporation MCP79 SATA Controller (rev b1)
00:10.0 PCI bridge: nVidia Corporation MCP79 PCI Express Bridge (rev b1)
00:15.0 PCI bridge: nVidia Corporation MCP79 PCI Express Bridge (rev b1)
01:00.0 VGA compatible controller: nVidia Corporation ION VGA (rev b1)
02:00.0 Network controller: Atheros Communications Inc. AR9285 Wireless Network Adapter (PCI-Express) (rev 01)
By the way, ASRock has a rather bewildering range of variants to the ION 330 series, and it would be easy to end up ordering a model without WiFi if you're not careful. If you do want one with WiFi, ask the shop you're buying from whether the precise model has both LAN and WiFi capabilities.

Fitzcarraldo
Sagely Hen
Posts: 8200
Joined: Sat Mar 10, 2007 5:40
Location: United Kingdom
Contact:

Re: ASRock ION 330HT nettop running Sabayon Linux

Post by Fitzcarraldo » Fri Mar 19, 2010 22:43

I have just completed upgrading SL using Entropy, so the nettop is now running the 2.6.33-sabayon kernel and all the packages are fully up-to-date with the latest in the Entropy repository. I had to re-install the package nvidia-drivers in order to get X up again on console 7, but otherwise the upgrade was routine, albeit time-consuming.

I have also just configured PulseAudio according to the thread Getting PulseAudio to cooperate and it works fine. I had to add the file /etc/asound.conf as explained in that thread.

As for the ALSA problem of the popping, I have added the line:

Code: Select all

options snd-hda-intel power_save=0 power_save_controller=N
to the file /etc/modprobe.d/alsa.conf as suggested by smb96 in the thread Getting Rid of the Loud Pop. It seems to have helped, although I have no idea why as the audio controller in the 330HT is an nVidia controller (see details in previous post) but alsaconf did report the card as an Intel device :? although alsamixer reports it as an nVidia device.

Anyway, so even PulseAudio works on this nettop.

Fitzcarraldo
Sagely Hen
Posts: 8200
Joined: Sat Mar 10, 2007 5:40
Location: United Kingdom
Contact:

Re: ASRock ION 330HT nettop running Sabayon Linux

Post by Fitzcarraldo » Sat Mar 20, 2010 21:00

The infra-red receiver for the remote controller needs a driver module lirc_wb677.ko, but ASRock have only provided it for the Ubuntu 9.10 kernel (2.6.31), and the source code contains several Ubuntu-specific things which are difficult to translate to other Linux distributions. The Arch Linux guys are also banging their heads against a brick wall trying to compile lirc_wb677.ko for their kernel: ASRock ION 330HT - MCE remote not working. Until someone comes up with a suitable way of hacking the Ubuntu files for other distributions, it looks like the only solution would be to buy a USB infra-red receiver that is known to work with Linux. The XBMC forums have a thread about the remote controller for the ASRock ION 330HT, and one forum member recommended the Cyberlink Media Center Remote Control with Mini USB IR Receiver. The problem with the 330HT is not the remote controller itself, it's the infra red receiver, which needs a driver (lirc_wb677.ko) that only exists for Ubuntu kernel 2.6.31. Hence the work-around of buying an infra-red receiver USB stick for which there is a lirc module available.

Something like the Loop Pointer In-Air Mouse from Hillcrest Labs might also work:

Image

Fitzcarraldo
Sagely Hen
Posts: 8200
Joined: Sat Mar 10, 2007 5:40
Location: United Kingdom
Contact:

Re: ASRock ION 330HT nettop running Sabayon Linux

Post by Fitzcarraldo » Mon Mar 22, 2010 10:33

I've been trying to get the infra-red receiver in the ASRock ION 330HT to work, so that I can use the remote controller.

I managed to compile the module lirc_wb677.ko but cannot modprobe it because the following occurs during the compilation of the module:

Code: Select all

WARNING: "lirc_register_driver" [/usr/src/lirc-nct677x-src-1.0.4/lirc_wb677.ko] undefined!
WARNING: "lirc_unregister_driver" [/usr/src/lirc-nct677x-src-1.0.4/lirc_wb677.ko] undefined!
When I try to modprobe lirc_wb677 or modprobe -f lirc_wb677 the error message is:

Code: Select all

FATAL: Error inserting lirc_wb677 (/lib/modules/2.6.33-sabayon/kernel/drivers/lirc/lirc_wb677/lirc_wb677.ko): Unknown symbol in module, or unknown parameter (see dmesg)
and dmesg shows:

Code: Select all

[37283.465706] lirc_wb677: Unknown symbol lirc_unregister_driver
[37283.467199] lirc_wb677: Unknown symbol lirc_register_driver
which is presumably a consequence of the two warning messages during compilation.

I used the official driver version 1.0.4 from ASRock, extracting and modifying the source code as I explain below in detail. To compile the module it is necessary to have the source code of lirc too, and I tried first using the officially-released lirc-0.8.6 source code, then the latest lirc source code from the LIRC CVS. Both give exactly the same result.

Anyway, below I show what I did in case anyone else out there -- whatever the Linux distribution -- is working on compiling the driver for the ASRock ION 330HT. Maybe they can work out how to get the compiler to see the two functions lirc_register_driver and lirc_unregister_driver that are in lirc_dev.c

These are the steps I took:

I downloaded the file IR(9.10).zip from the ASRock Web site to /home/fitzcarraldo/Downloads/. It is ASRock's Ubuntu 9.10 driver for the IR receiver in the ION 330HT.

I extracted the following from it:

/home/fitzcarraldo/Downloads//lirc-nct677x-src-1.0.4-ubuntu9.10.deb
/home/fitzcarraldo/Downloads//lirc-nct677x-1.0.4-ubuntu9.10.deb

I installed the utility deb2targz and used it to extract:

/home/fitzcarraldo/Downloads//lirc-nct677x-src-1.0.4-ubuntu9.10.tar.gz
/home/fitzcarraldo/Downloads//lirc-nct677x-1.0.4-ubuntu9.10.tar.gz

and from those I extracted:

/home/fitzcarraldo/Downloads//usr/share/...
/home/fitzcarraldo/Downloads//usr/src/...

I downloaded lirc-0.8.6.tar.bz2 from http://www.lirc.org/software.html to /home/fitzcarraldo/Downloads/ and extracted it to:

/home/fitzcarraldo/Downloads/lirc-0.8.6/...

I downloaded the file lirc-LP529514.patch from https://bugs.launchpad.net/ubuntu/+sour ... bug/529514 (see link in Comment #1) to /home/fitzcarraldo/Downloads/, to modify lirc_dev.h to be able to compile with the 2.6.33 kernel.

Then I did the following:

Code: Select all

asrockion330ht fitzcarraldo # cp -r /home/fitzcarraldo/Downloads/lirc-0.8.6 /usr/src/
asrockion330ht fitzcarraldo # cp -p /home/fitzcarraldo/Downloads/usr/share/lirc/remotes/lirc_wb677/lircd.conf.wb677 /usr/share/lirc/remotes/lirc_wb677/lircd.conf.wb677
asrockion330ht fitzcarraldo # cp -r /home/fitzcarraldo/Downloads/usr/src/lirc-nct677x-src-1.0.4/lirc_wb677 /usr/src/lirc-nct677x-src-1.0.4/
asrockion330ht fitzcarraldo # mkdir -p /lib/modules/2.6.33-sabayon/kernel/drivers/lirc/lirc_wb677
asrockion330ht fitzcarraldo # cd /usr/src/lirc-nct677x-src-1.0.4 
asrockion330ht lirc-nct677x-src-1.0.4 # nano /usr/src/lirc-nct677x-src-1.0.4/Makefile 
asrockion330ht lirc-nct677x-src-1.0.4 # cat Makefile 
#!/bin/bash

        LIRC_DIR := /usr/src/lirc-0.8.6

        obj-m += lirc_wb677.o

        lirc_wb677-objs := lirc_wb677_main.o lirc_wb677_mouse_kbd.o

        KSRC ?= /lib/modules/$(shell uname -r)/build

        PWD := $(shell pwd)
modules:
        echo KERNELDIR=$(KSRC)
        $(MAKE) -C $(KSRC) -I $(LIRC_DIR) M=$(PWD) modules


install:
#       /etc/init.d/lircd stop
        rmmod lirc_wb677 || echo "lirc_wb677.ko is not executing"
        file="lirc_wb677.ko"; \
        dir="/lib/modules/$(shell uname -r)/kernel/drivers/lirc/lirc_wb677"; \
        if test -d "$$dir"; then echo ""; else mkdir -p $$dir; fi; \
        cp -vf *.ko $$dir
        depmod -a
#       patch -p0 /usr/share/lirc/lirc.hwdb < /usr/share/lirc/lirc_nct667x-src-1.0.4.patch
        @echo "      You can configure lirc now."
        @echo "      And start lirc by executing \"/etc/init.d/lirc start\""

uninstall:
#       /etc/init.d/lircd stop
        ( rmmod lirc_wb677 ) || echo "lirc_wb677.ko is not executing"
        dir="/lib/modules/$(shell uname -r)/kernel/drivers/lirc/lirc_wb677"; \
        if test -d "$$dir"; then rm -R $$dir; fi;
        depmod -a
#       patch -R -p0 /usr/share/lirc/lirc.hwdb < /usr/share/lirc/lirc_nct667x-src-1.0.4.patch

clean:
        rm -rf *.o *.ko *.mod.c Module.symvers .tmp_versions .*.cmd
asrockion330ht lirc-nct677x-src-1.0.4 # patch /usr/src/lirc-0.8.6/drivers/lirc_dev/lirc_dev.h < /home/fitzcarraldo/Downloads/lirc-LP529514.patch
asrockion330ht lirc-nct677x-src-1.0.4 # make
echo KERNELDIR=/lib/modules/2.6.33-sabayon/build
KERNELDIR=/lib/modules/2.6.33-sabayon/build
make -C /lib/modules/2.6.33-sabayon/build -I /usr/src/lirc-0.8.6 M=/usr/src/lirc-nct677x-src-1.0.4 modules
make[1]: Entering directory `/usr/src/linux-2.6.33-sabayon'
  CC [M]  /usr/src/lirc-nct677x-src-1.0.4/lirc_wb677_main.o
In file included from /usr/src/linux-2.6.33-sabayon/arch/x86/include/asm/uaccess.h:571,
                 from include/linux/poll.h:13,
                 from /usr/src/lirc-nct677x-src-1.0.4/lirc_wb677.h:25,
                 from /usr/src/lirc-nct677x-src-1.0.4/lirc_wb677_main.c:2:
In function ‘copy_from_user’,
    inlined from ‘lirc_write’ at /usr/src/lirc-nct677x-src-1.0.4/lirc_wb677_main.c:674:
/usr/src/linux-2.6.33-sabayon/arch/x86/include/asm/uaccess_32.h:212: warning: call to ‘copy_from_user_overflow’ declared with attribute warning: copy_from_user() buffer size is not provably correct
  CC [M]  /usr/src/lirc-nct677x-src-1.0.4/lirc_wb677_mouse_kbd.o
  LD [M]  /usr/src/lirc-nct677x-src-1.0.4/lirc_wb677.o
  Building modules, stage 2.
  MODPOST 1 modules
WARNING: "lirc_register_driver" [/usr/src/lirc-nct677x-src-1.0.4/lirc_wb677.ko] undefined!
WARNING: "lirc_unregister_driver" [/usr/src/lirc-nct677x-src-1.0.4/lirc_wb677.ko] undefined!
  CC      /usr/src/lirc-nct677x-src-1.0.4/lirc_wb677.mod.o
  LD [M]  /usr/src/lirc-nct677x-src-1.0.4/lirc_wb677.ko
make[1]: Leaving directory `/usr/src/linux-2.6.33-sabayon'
asrockion330ht lirc-nct677x-src-1.0.4 # make install
rmmod lirc_wb677 || echo "lirc_wb677.ko is not executing"
ERROR: Module lirc_wb677 does not exist in /proc/modules
lirc_wb677.ko is not executing
file="lirc_wb677.ko"; \
        dir="/lib/modules/2.6.33-sabayon/kernel/drivers/lirc/lirc_wb677"; \
        if test -d "$dir"; then echo ""; else mkdir -p $dir; fi; \
        cp -vf *.ko $dir

`lirc_wb677.ko' -> `/lib/modules/2.6.33-sabayon/kernel/drivers/lirc/lirc_wb677/lirc_wb677.ko'
depmod -a

      You can configure lirc now.
      And start lirc by executing "/etc/init.d/lirc start"
asrockion330ht lirc-nct677x-src-1.0.4 # modprobe lirc_wb677
FATAL: Error inserting lirc_wb677 (/lib/modules/2.6.33-sabayon/kernel/drivers/lirc/lirc_wb677/lirc_wb677.ko): Unknown symbol in module, or unknown parameter (see dmesg)
asrockion330ht lirc-nct677x-src-1.0.4 # dmesg | grep lirc
[ 5212.226536] lirc_wb677: Unknown symbol lirc_unregister_driver
[ 5212.227957] lirc_wb677: Unknown symbol lirc_register_driver
asrockion330ht lirc-nct677x-src-1.0.4 # 
I found the following on the LIRC Web site regarding the two error messages:
http://www.lirc.org/html/install.html wrote:Updating from lirc-0.8.4

There was an interface change in the lirc_dev kernel module. If you get an error message like

lirc_serial: Unknown symbol lirc_unregister_driver
lirc_serial: Unknown symbol lirc_register_driver

when trying to load any of the lirc kernel modules, then you have probably an old version of lirc_dev loaded. Make sure that the lirc_dev version that comes with this release is loaded.
The above quote relates to lirc-0.8.4 but I used the source code for lirc-0.8.6, so it should not apply. Anyway I decided to try using the latest version of lirc_dev.h from the LIRC CVS, but the result was the same as before. I then tried using the latest version of lirc (i.e. all LIRC files, not just lirc_dev.h) from the LIRC CVS but the result was also the same as before. I also installed the 2.6.33 kernel headers (previously the kernel headers were for 2.6.31) but the result was the same.

I have tried to get the lirc_wb677 source code to include the definition of the functions lirc_register_driver and lirc_unregister_driver from lirc_dev.c but cannot find a method that works. If anyone knows how to do it, I would be very grateful.

sjieke
Technological Hen
Posts: 321
Joined: Thu Mar 01, 2007 10:46
Location: Maldegem, Belgium

Re: ASRock ION 330HT nettop running Sabayon Linux

Post by sjieke » Mon Mar 22, 2010 15:12

My guess is that since you try to build against header files of lirc-0.8.6, you also need to build lirc-0.8.6 so your driver can link correctly to the lirc-0.8.6 libraries. If you want to load your driver/module I would expect that lirc-0.8.6 needs to be loaded also.

Fitzcarraldo
Sagely Hen
Posts: 8200
Joined: Sat Mar 10, 2007 5:40
Location: United Kingdom
Contact:

Re: ASRock ION 330HT nettop running Sabayon Linux

Post by Fitzcarraldo » Tue Mar 23, 2010 17:06

Thanks for your post, sjieke.

lirc-0.8.6-r2 was/is built. I installed it first from Entropy, then, when that didn't help, from Portage (the result was the same with either).

Today I compiled lirc from the CVS sources (see LIRC Web site page http://www.lirc.org/cvs.html for details) but the end result is still the same. Actually there is one difference: although I still cannot modprobe the driver, I can now force a modprobe using the "-f" switch; so I'm investigating that but at the moment have still not been able to get anything to work.

When I force the module to load, an additional entry is put into /proc/bus/input/devices as follows:

Code: Select all

I: Bus=0019 Vendor=1050 Product=0001 Version=0000
N: Name="MCE Remote Keyboard"
P: Phys=lirc_wb677
S: Sysfs=/devices/virtual/input/input8
U: Uniq=
H: Handlers=kbd mouse2 event8 
B: EV=7
B: KEY=30000 0 7 ff87207a c14057ff febeffdf ffefffff ffffffff fffffffe
B: REL=3
which looks promising.

To complicate matters, I think there is a Gentoo/SL-specific bug anyway in lirc-0.8.6 to lirc-0.8.6-r2 in Portage (and hence Entropy): see Gentoo Bugzilla Bug Report No. 301321. Also I don't think Praetor's hack in Comment #8 in that bug report is valid for kernel >=2.6.33: see the C source code of the drivers in the autoconf.patch file in that Bug report for the reason.

Because the source code of the CVS version of LIRC is newer than the 0.8.6 version used in the 0.8.6 and 0.8.6-r2 ebuilds (and Entropy built packages), I had to apply the autoconf.patch patches to the drivers' source code (official 0.8.6 release and, later, CVS version) by hand in the /usr/src/lirc-0.8.6/drivers/ sub-directories; it's not too time-consuming, fortunately. I have not yet done that again today for compiling the CVS version of LIRC, so that is my next experiment, but I don't hold out much hope.

To get the module to compile I also have to do the following (as I did yesterday):

Code: Select all

# mkdir -p /usr/src/lirc-0.8.6/drivers/lirc_dev/drivers
# cp /usr/src/lirc-0.8.6/drivers/lirc_dev.h /usr/src/lirc-0.8.6/drivers/lirc_dev/drivers/
As far as the lirc_wb677 driver module's dependency is concerned, modprobe would load any required modules (it looks in /lib/modules/2.6.33-sabayon/modules.dep):

Code: Select all

# cat /lib/modules/2.6.33-sabayon/modules.dep | grep lirc
kernel/drivers/lirc/lirc_wb677/lirc_wb677.ko: misc/lirc_dev.ko
misc/lirc_dev.ko:
misc/lirc_serial.ko: misc/lirc_dev.ko
#
and that happens if I force the module to load:

Code: Select all

# rmmod lirc_wb677
# rmmod lirc_dev
# modprobe -f lirc_wb677
# lsmod | grep lirc
lirc_wb677             22300  0 
lirc_dev                7706  1 lirc_wb677
#
If I load module lirc_dev manually first, it still does not let me modprobe lirc_wb677 without forcing it.

The Ubuntu Makefile for the driver stops the LIRC daemon before beginning the build. Here's the actual Ubuntu Makefile:

Code: Select all

#!/bin/bash

# Notice :
#	for dkms, make cmd was defined in dkms.conf as MAKE[0]. generally we define it as 
#   MAKE[0] = "make ..."
# 	however, when dkms build this target, it was invoked by "make KERNELRELEASE=xxx ..." instead
#   that cause the plain make file below can not work again : 
#
#		ifneq ($(KERNELRELEASE),)
#			obj-m := lirc_wb667.o
#			lirc_wb667-objs := lirc_wb667.o
#		else
#			KERNEL_SRC_TREE ?= /lib/modules/$(shell uname -r)/build
#			PWD := $(shell pwd)
#			modules modules_install clean:
#				make -C $(KERNEL_SRC_TREE) M=$(PWD) [email protected]
#		endif
#
# it can not work because KERNELRELEASE was defined in dkms's case. so we should merge the two 
# cases together :

# on Linux 2.6 kernel
# If KERNELRELEASE is defined, we've been invoked from the
# kernel build system and can use its language.



	LIRC_DIR := /usr/src/lirc-0.8.6

	obj-m += lirc_wb677.o

	lirc_wb677-objs := lirc_wb677_main.o lirc_wb677_mouse_kbd.o

	KSRC ?= /lib/modules/$(shell uname -r)/build

	PWD := $(shell pwd)
modules:
	echo KERNELDIR=$(KSRC)
	$(MAKE) -C $(KSRC) -I $(LIRC_DIR) M=$(PWD) modules


# Following "install", "uninstall" and "clean" are not for dkms.

install:
	/etc/init.d/lirc stop
	rmmod lirc_wb677 || echo "lirc_wb677.ko is not executing"
	file="lirc_wb677.ko"; \
	dir="/lib/modules/$(shell uname -r)/kernel/ubuntu/lirc/lirc_wb677"; \
	if test -d "$$dir"; then echo ""; else mkdir -p $$dir; fi; \
	cp -vf *.ko $$dir
	depmod -a
	patch -p0 /usr/share/lirc/lirc.hwdb < /usr/share/lirc/lirc_nct667x-src-1.0.0-ubuntu9.10.patch
	@echo ""
	@echo "Hint: You can execute \"dpkg-reconfigure lirc\" to configure lirc."
	@echo "      And start lirc by executing \"/etc/init.d/lirc start\""

uninstall:
	/etc/init.d/lirc stop
	( rmmod lirc_wb677 ) || echo "lirc_wb677.ko is not executing"
	dir="/lib/modules/$(shell uname -r)/kernel/ubuntu/lirc/lirc_wb677"; \
	if test -d "$$dir"; then rm -R $$dir; fi;
	depmod -a
	patch -R -p0 /usr/share/lirc/lirc.hwdb < /usr/share/lirc/lirc_nct667x-src-1.0.0-ubuntu9.10.patch

clean:
	rm -rf *.o *.ko *.mod.c Module.symvers .tmp_versions .*.cmd
and here's my hacked version for my SL installation:

Code: Select all

#!/bin/bash

        LIRC_DIR := /usr/src/lirc-0.8.6

        obj-m += lirc_wb677.o

        lirc_wb677-objs := lirc_wb677_main.o lirc_wb677_mouse_kbd.o

        KSRC ?= /lib/modules/$(shell uname -r)/build

        PWD := $(shell pwd)
modules:
        echo KERNELDIR=$(KSRC)
        $(MAKE) -C $(KSRC) -I $(LIRC_DIR) M=$(PWD) modules

install:
# Following line edited but then commented out because it stops script if lircd not already running:
#       /etc/init.d/lircd stop
        rmmod lirc_wb677 || echo "lirc_wb677.ko is not executing"
        file="lirc_wb677.ko"; \
        dir="/lib/modules/$(shell uname -r)/kernel/drivers/lirc/lirc_wb677"; \
        if test -d "$$dir"; then echo ""; else mkdir -p $$dir; fi; \
        cp -vf *.ko $$dir
        depmod -a
# Following line edited but then commented out because /usr/share/lirc/lirc.hwdb does not exist on my PC:
#       patch -p0 /usr/share/lirc/lirc.hwdb < /usr/src/lirc_wb677-1.0.4/lirc_nct667x-lirc0.8.6.patch
        @echo ""
        @echo "Hint: You can execute ./configure in /usr/src/lirc-0.8.6/ to configure lirc."
        @echo "      And start lirc by executing \"/etc/init.d/lircd start\""

uninstall:
# Following line edited but then commented out because it stops script if lircd not already running:
#       /etc/init.d/lircd stop
        ( rmmod lirc_wb677 ) || echo "lirc_wb677.ko is not executing"
        dir="/lib/modules/$(shell uname -r)/kernel/drivers/lirc/lirc_wb677"; \
        if test -d "$$dir"; then rm -R $$dir; fi;
        depmod -a
# Following line edited but then commented out because /usr/share/lirc/lirc.hwdb does not exist on my PC:
#       patch -R -p0 /usr/share/lirc/lirc.hwdb < /usr/src/lirc_wb677-1.0.4/lirc_nct667x-lirc0.8.6.patch

clean:
        rm -rf *.o *.ko *.mod.c Module.symvers .tmp_versions .*.cmd
LIRC is not user-friendly at all. It's a pity that ASRock only developed a driver for Ubuntu, which Ubuntu users are now installing successfully: Enable remote [controller] support for Asrock ION 330HT.

EDIT (March 24, 2010 03:26 UTC): Ahhh... I've just realised that by compiling lirc-CVS in /usr/src/lirc-0.8.6/ and selecting another IR receiver (because the receiver I want, Nuvoton, is not in the list of selectable devices displayed by LIRC when I run ./setup.sh) it builds lirc_dev.ko, which is a module that lirc_wb677.ko apparently needs (which is why when I 'modprobe -f lirc_wb677' it loads lirc_dev.ko). So sjieke's advice was very much on the right track.

Fitzcarraldo
Sagely Hen
Posts: 8200
Joined: Sat Mar 10, 2007 5:40
Location: United Kingdom
Contact:

Re: ASRock ION 330HT nettop running Sabayon Linux

Post by Fitzcarraldo » Wed Mar 24, 2010 0:06

Some more information, in case it is pertinent:

After forcing the module to load, dmesg shows the following:

Code: Select all

# dmesg | grep lirc
[15663.683524] lirc_dev: IR Remote Control driver registered, major 61 
[15663.688244] lirc_wb677_cir 00:04: activated
[15663.688314] lirc_wb677 w677hga: chip id high: 0xb4
[15663.688326] lirc_wb677 w677hga: chip id low: 0x73 expect:0x73
[15663.689238] lirc_dev: lirc_register_driver: sample_rate: 0
I don't know whether or not the above indicates the driver is working correctly.

However, the LIRC daemon won't run:

Code: Select all

# /etc/init.d/lircd start
* Caching service dependencies...                                                                                                                                               [ ok ]
* Starting lircd...
ln: creating symbolic link `/dev/lircd': File exists                                                                                                                            [ ok ]
* ERROR: lircd failed to start
#
Looking at the above, the init script is trying to run /dev/lircd, which is a symlink. So I looked at /dev/lircd:

Code: Select all

# ls -la /dev/lir*
crw-r--r-- 1 root root 61, 0 Mar 23 17:13 /dev/lirc
crw-rw---- 1 root root 61, 0 Mar 23 19:50 /dev/lirc0
lrwxrwxrwx 1 root root    19 Mar 23 20:50 /dev/lircd -> /var/run/lirc/lircd
and the "/dev/lircd" and "/var/run/lirc/lircd" are flashing red in Konsole, which means that the target /var/run/lirc/lircd does not exist. Sure enough:

Code: Select all

# ls -la /var/run/lirc/
total 8
drwxr-xr-x  2 root root 4096 Mar 23 22:27 .
drwxr-xr-x 30 root root 4096 Mar 23 21:27 ..
prw-r--r--  1 root root    0 Mar 22 21:22 lircm
#
The missing file /var/run/lirc/lircd would be a socket file (i.e. if you use the command 'ls -la' then the first character in the file attributes would be an "s") -- see the explanatory page Driver Model on the LIRC Web site. The pipe file /var/run/lirc/lircm is present in my case, as can be seen above.

I've done quite a bit of googling and tried several times to rebuild lirc-CVS selecting different things from LIRC's ./setup.sh menu, but cannot get LIRC to work. The XBMC forums thread on the ASRock 330HT remote controller, plus other Web sites discussing the installation of the driver under Ubuntu, mention that "Nuvoton" is listed in the Ubuntu LIRC GUI installation menu, but it isn't in my case. To see if it made any difference I've copied the file lircrc_nuvoton from the Ubuntu driver tarball to /usr/src/lirc-0.8.6/remotes/lirc_wb677/lircrc.nuvoton, /usr/src/lirc-0.8.6/remotes/lirc_wb677/lircrc_nuvoton, /usr/share/lirc/remotes/lirc_wb677/lircrc.nuvoton and /usr/share/lirc/remotes/lirc_wb677/lircrc_nuvoton, but it didn't help. I've also copied various lirc_wb677 directories to lirc-0.8.6/drivers and lirc-0.8.6/remotes and so on, but nothing results in "Nuvoton" appearing as a selectable item in the LIRC configuration menu when I run ./setup.sh.

LIRC is making me :evil: :roll:

Fitzcarraldo
Sagely Hen
Posts: 8200
Joined: Sat Mar 10, 2007 5:40
Location: United Kingdom
Contact:

Re: ASRock ION 330HT nettop running Sabayon Linux

Post by Fitzcarraldo » Thu Mar 25, 2010 14:06

I am continuing to post my efforts to get the built-in IR receiver working, just in case someone reads this thread from another distribution working on compiling lirc_wb677.ko and lirc itself. Anyway, today's efforts are summarised below:

I edited /usr/src/lirc-0.8.6/configure and /usr/src/lirc-0.8.6/configure.ac and /usr/src/lirc-0.8.6/setup.data to add lirc_wb677. It was not difficult to do: I just searched for all occurrences of wpc8769l in those files and inserted the appropriate code for wb677 before the wpc8769l entries.

I renamed /usr/src/lirc-0.8.6/remotes/lirc_wb677/, which I had created previously, to /usr/src/lirc-0.8.6/remotes/wb677/ and made sure it only contained the file lircd.conf.wb677

I copied /usr/src/lirc-0.8.6/drivers/lirc_wpc8769l/Module.symvers to /usr/src/lirc-0.8.6/drivers/lirc_wb677/Module.symvers (the file Module.symvers in each of the directories drivers/lirc_* appears to be identical).

I copied /usr/src/lirc-0.8.6/drivers/lirc_wpc8769l/Makefile to /usr/src/lirc-0.8.6/drivers/lirc_wb677/Makefile and edited the latter to look like the following:

Code: Select all

## $Id: Makefile.am,v 1.1 2009/01/03 17:30:35 lirc Exp $

## Process this file with automake to produce Makefile.in

## this is so that Automake includes the C compiling definitions, and
## includes the source files in the distribution.
EXTRA_PROGRAMS = automake_dummy
automake_dummy_SOURCES = lirc_wb677_main.c lirc_wb677.h lirc_wb677_mouse_kbd.c lirc_wb677_mouse_kbd.h lirc_wb677_common_extern.h wb83677hg_ir.h

## there is no *just* object file support in automake.  This is close enough
module_DATA = lirc_wb677_main.o lirc_wb677_mouse_kbd.o

include ../Makefile.common
Now when I run ./autogen.sh in /usr/src/lirc-0.8.6 it displays an entry for the Nuvoton wb677 and allows me to select it from the Driver configuration menu. When I select 'Save configuration and run configure' from the main menu ./setup.sh runs to completion, as do the make and make install commands. I.e. I can do the following without any apparent errors occurring:

Code: Select all

# cd /usr/src/lirc-0.8.6
# ./autogen.sh
# ./setup.sh
# make
# make install
However, I still get the same behaviour as yesterday:

Code: Select all

# modprobe lirc_wb677
FATAL: Error inserting lirc_wb677 (/lib/modules/2.6.33-sabayon/misc/lirc_wb677.ko): Unknown symbol in module, or unknown parameter (see dmesg)
# modprobe -f lirc_wb677
# lsmod | grep lirc
lirc_wb677             22300  0 
lirc_dev                7706  1 lirc_wb677
# /etc/init.d/lircd start
* Starting lircd...                                                                                                                                                             [ !! ]
* ERROR: lircd failed to start
# /etc/init.d/lircd start
* Starting lircd...
ln: creating symbolic link `/dev/lircd': File exists                                                                                                                            [ ok ]
* ERROR: lircd failed to start
# ls -la /dev/lirc*
crw-r--r-- 1 root root 61, 0 Mar 25 12:27 /dev/lirc
crw-rw---- 1 root root 61, 0 Mar 25 12:28 /dev/lirc0
lrwxrwxrwx 1 root root    19 Mar 25 12:29 /dev/lircd -> /var/run/lirc/lircd
# ls -la /var/run/lirc/
total 8
drwxr-xr-x  2 root root 4096 Mar 25 12:29 .
drwxr-xr-x 30 root root 4096 Mar 25 11:50 ..
prw-r--r--  1 root root    0 Mar 22 21:22 lircm
So I'm not sure where to go from here. I can compile the module lirc_wb677.ko (and lirc_dev.ko). I seem to be able to configure lirc for lirc_wb677 and compile lirc. But something is still not right with lirc as there is still no socket file lircd in /var/run/lirc/ so I don't know what else to try. I think I may need to edit or create some files in the /usr/src/lirc-0.8.6/daemons/ directory, but what? Very frustrating after a couple of days of heavy hacking. :?

sjieke
Technological Hen
Posts: 321
Joined: Thu Mar 01, 2007 10:46
Location: Maldegem, Belgium

Re: ASRock ION 330HT nettop running Sabayon Linux

Post by sjieke » Thu Mar 25, 2010 15:58

First I must admit I admire your enthousiasm to keep trying :alien:

I read everything you did, but unfortunately I don't have the time to try myself. I even don't have a remote I could use to test. But in skimming through your posts again I couldn't find anywhere that you could start the lirc deamon without the specific driver for your control loaded. So if you haven't done it already I would suggest the following (almost starting all over again):

1) Try to get the lirc deamon running, without your needed driver. You could even revert back to the portage or entropy version.
2) If that works, you can go to the next level. Get the source code of the lirc version you need, build it and get it running, again without your driver.
3) Do the modifications and all you need to build lirc AND your needed driver. Try to start lirc without loading your driver (if that is possible). Then start lirc with your driver loaded

The reason I would start again is because you don't have a clue why lirc doesn't start. Is it because of the driver and the need to force it to load, some of your modifications,...

Probably it would be very handy if you could find some logfile somewhere the find the reason why lirc failed to start. Maybe you can start it in a debug mode or maybe you can start it as a normal process, not as a deamon and get some debug output on the commandline.

All this are just the things that pop in my head after reading your posts. Probably you already tried most of it, or some are probably out of context, but maybe some of my thoughts provide you the insight or the AHA moment you need :mrgreen:

Fitzcarraldo
Sagely Hen
Posts: 8200
Joined: Sat Mar 10, 2007 5:40
Location: United Kingdom
Contact:

Re: ASRock ION 330HT nettop running Sabayon Linux

Post by Fitzcarraldo » Thu Mar 25, 2010 18:37

Thanks for your latest advice, sjieke. You're right that I could never get the LIRC daemon to load.

But I thought that the LIRC daemon could only be started if a driver module is installed? Is my understanding incorrect?

Anyway, I'll take your advice and start afresh.

I did a make uninstall and a make clean in both the /usr/src/lirc-0.8.6/ and /usr/src/lirc_wb677-1.0.4/ directories and then deleted them both (making a backup first, of course).

Then I re-installed lirc-0.8.6-r2 using Entropy (as the latest in Portage is also 0.8.6-r2) and tried to start the lircd daemon:

Code: Select all

# /etc/init.d/lircd start
* Starting lircd...                                                                                                                                                             [ !! ]
* ERROR: lircd failed to start
# 
As you can see, it still fails to run. It's still because of the aforementioned missing socket file.

So, if, as you imply, a driver module does not have to be loaded then the problem lies fully with LIRC 0.8.6-r2. Unfortunately /var/log/messages sheds no light on the reason:

Code: Select all

Mar 25 17:30:41 asrockion330ht /etc/init.d/lircd[2042]: ERROR: lircd failed to start
and I cannot find any log files for LIRC.

I think lirc-0.8.6-r2 is buggy. In one of my earlier posts I mentioned Gentoo Bugzilla Bug Report No. 301321; according to Comment #15 on 19 March in that bug report, the autoconf.patch was not included in lirc-0.8.6-r2, which would affect users of kernel 2.6.33 (e.g. me). This is why I applied that patch in my earlier attempts. I'll use Portage to re-install lirc-0.8.6-r2, unpack the tarball in /usr/portage/distfiles/, apply the patch and repack lirc, regenerate the manifest and try to rebuild a hacked lirc-0.8.6-r2 with the autoconf patch applied.

Post Reply