LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-22-2013, 04:32 PM   #1
billvance
Member
 
Registered: Sep 2013
Location: Bothell, Washington USA
Distribution: Kubuntu 12.04
Posts: 57

Rep: Reputation: Disabled
Compiling Device drivers


Howdy;

I'm Running Kubuntu 12.04 here.

I've done this a long time ago, but some things change, so
with the current lack of complete documentation, I'm left
with questions.

I recently bought a Sabrent usb video capture dongle, and
have downloaded a linux driver for it. It is stk1160-v4l.c
for release 0.9.3\_for\_v3.2.

Anyway, as I recall, the file needs to go into a particular
directory in the kernel source code, and be listed in a
particular file in order to be compiled. The kernel source
I have at the moment, (linux-source-3.2.0), doesn't seem to
have anything about this in the zillions of README files it
came with. At least I haven't found it yet.

The README.md file that was the only file to come with the
driver .c file says all you have to do is just type, "make",
and, "make install", but that doesn't do anything but error
generation.

Neither situation is helpful.

Does anybody know what I need to do here?

Thanks in advance.

Bill
 
Old 09-22-2013, 04:39 PM   #2
odiseo77
Senior Member
 
Registered: Dec 2004
Location: Caracas, Venezuela
Distribution: Debian Sid, OpenSUSE 13.2
Posts: 1,147

Rep: Reputation: 506Reputation: 506Reputation: 506Reputation: 506Reputation: 506Reputation: 506
I'm not an expert compiling drivers, but maybe if you copy here the error you get when you type make (on a clean, just uncompressed driver), someone might give you a hand
 
Old 09-23-2013, 02:16 AM   #3
billvance
Member
 
Registered: Sep 2013
Location: Bothell, Washington USA
Distribution: Kubuntu 12.04
Posts: 57

Original Poster
Rep: Reputation: Disabled
It wouldn't be the slightest bit helpful, as they
were all procedural in nature; I.e., no target, no
config/header files etc.

As I said, I need the proper dir to put it in, and
the list to add it to, assuming that's still the
proper procedure for these kinds of files. If its
not, then I need the new info for doing that.

Bill
 
Old 09-23-2013, 02:30 AM   #4
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=14, FreeBSD_10{.0|.1|.2}
Posts: 3,876
Blog Entries: 1

Rep: Reputation: 1998Reputation: 1998Reputation: 1998Reputation: 1998Reputation: 1998Reputation: 1998Reputation: 1998Reputation: 1998Reputation: 1998Reputation: 1998Reputation: 1998
Quote:
Originally Posted by odiseo77 View Post
I'm not an expert compiling drivers, but maybe if you copy here the error you get when you type make (on a clean, just uncompressed driver), someone might give you a hand
Quote:
Originally Posted by billvance View Post
It wouldn't be the slightest bit helpful, as they
were all procedural in nature; I.e., no target, no
config/header files etc.

As I said, I need the proper dir to put it in, and
the list to add it to, assuming that's still the
proper procedure for these kinds of files. If its
not, then I need the new info for doing that.

Bill
That is a rather rude and unhelpful response...

So, if we cannot see the errors, what would you consider would be helpful to us to help solve your problem?


*** UPDATED ***

The "proper procedure" for these types of files (driver.c), as the README says, is to compile them (i.e., run make as instructed). If make fails, then the proper procedure is to look at the resulting errors and meet any indicated requirements, then make it again until successful.

There is no magic directory or list that makes it all work error free.

Last edited by astrogeek; 09-23-2013 at 02:56 AM.
 
1 members found this post helpful.
Old 09-23-2013, 03:18 AM   #5
billvance
Member
 
Registered: Sep 2013
Location: Bothell, Washington USA
Distribution: Kubuntu 12.04
Posts: 57

Original Poster
Rep: Reputation: Disabled
My bad. Chalk it up to frustration and too long
without sleep, as I've been restoring my system
after re, re, re installing the OS. It is finally
more or less back to normal.

I'm no C programmer either. "C", stands for, "Cuneiform".

In reading through the file, It seemed to need being
in a particular directory for compiling, or need
full path/names for the #include files. That all
seemed do-able, but when I checked them, the last
two needed include files are AWOL on this system. These are:

#include "stk1160.h"
#include "stk1160-reg.h"

So now I have to find these for the 3.2.0 kernel.
Got any clues on those?

Bill
 
Old 09-23-2013, 03:20 PM   #6
odiseo77
Senior Member
 
Registered: Dec 2004
Location: Caracas, Venezuela
Distribution: Debian Sid, OpenSUSE 13.2
Posts: 1,147

Rep: Reputation: 506Reputation: 506Reputation: 506Reputation: 506Reputation: 506Reputation: 506
Quote:
Originally Posted by billvance View Post
My bad. Chalk it up to frustration and too long
without sleep, as I've been restoring my system
after re, re, re installing the OS. It is finally
more or less back to normal.

I'm no C programmer either. "C", stands for, "Cuneiform".

In reading through the file, It seemed to need being
in a particular directory for compiling, or need
full path/names for the #include files. That all
seemed do-able, but when I checked them, the last
two needed include files are AWOL on this system. These are:

#include "stk1160.h"
#include "stk1160-reg.h"

So now I have to find these for the 3.2.0 kernel.
Got any clues on those?

Bill
You're not doing what you're told (which is really rude and frustrating for us). Again -- and I'm asking this for the last time -- what is the error message you get when you execute make in the clean driver directory? (By "clean" I mean a driver you've just decompressed and you haven't modified).
 
Old 09-23-2013, 04:25 PM   #7
billvance
Member
 
Registered: Sep 2013
Location: Bothell, Washington USA
Distribution: Kubuntu 12.04
Posts: 57

Original Poster
Rep: Reputation: Disabled
Ok, here you are.

makemake: *** No targets specified and no makefile found. Stop.

or,

make stk1160-v4l.c
make: Nothing to be done for `stk1160-v4l.c'.
 
Old 09-23-2013, 04:57 PM   #8
odiseo77
Senior Member
 
Registered: Dec 2004
Location: Caracas, Venezuela
Distribution: Debian Sid, OpenSUSE 13.2
Posts: 1,147

Rep: Reputation: 506Reputation: 506Reputation: 506Reputation: 506Reputation: 506Reputation: 506
Alright, so it seems you're not executing make inside the driver directory (or perhaps it doesn't have a makefile?). First, decompress the driver file. Depending on the file format you should execute tar zxvf file.tar.gz, or tar xjvf file.tar.bz2, or unzip file.zip.

Then use cd to enter the decompressed directory:

Code:
cd <path_to_the_driver_directory_here>
Finally, use ls to see what's inside the directory:

Code:
ls -l
Post the output of the last command here.

Last edited by odiseo77; 09-23-2013 at 04:58 PM.
 
Old 09-23-2013, 05:25 PM   #9
billvance
Member
 
Registered: Sep 2013
Location: Bothell, Washington USA
Distribution: Kubuntu 12.04
Posts: 57

Original Poster
Rep: Reputation: Disabled
Here ya go.

ls -l
total 24
-rw-r--r-- 1 bill bill 2912 Jul 29 14:11 README.md
-rw-r--r-- 1 bill bill 18084 Sep 22 23:55 stk1160-v4l.c
 
Old 09-23-2013, 06:11 PM   #10
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=14, FreeBSD_10{.0|.1|.2}
Posts: 3,876
Blog Entries: 1

Rep: Reputation: 1998Reputation: 1998Reputation: 1998Reputation: 1998Reputation: 1998Reputation: 1998Reputation: 1998Reputation: 1998Reputation: 1998Reputation: 1998Reputation: 1998
Hey Bill!

Can you post the contents of the README.

If it says to run make, then there must be a Makefile somewhere, maybe the README has another clue.

Have you tried to build it with something like...

Code:
gcc -o driver stk1160-v4l.c
Maybe the output of that would provide additional clues.
 
Old 09-23-2013, 07:00 PM   #11
billvance
Member
 
Registered: Sep 2013
Location: Bothell, Washington USA
Distribution: Kubuntu 12.04
Posts: 57

Original Poster
Rep: Reputation: Disabled
I'll have to get back with you later, maybe tonight,
definitely tomorrow. My sleep cycles are catching up with me again.

Bill
 
Old 09-24-2013, 06:35 AM   #12
zeebra
Member
 
Registered: Dec 2011
Distribution: Mageia 3, Debian Wheezy, Maemo, Linux Mint 14.
Posts: 200

Rep: Reputation: Disabled
I was looking into these things some days ago, and came over quite a lot of interesting material. It seems to depend somewhat on how your Kernel implementation is in your distro.

Official Kernel.org doucmentation on the process:
https://www.kernel.org/doc/Documenta...ld/modules.txt


This one is interesting. Debian, which Kubuntu is based on. Information is clear and good:
http://www.cyberciti.biz/tips/build-...urce-tree.html
another similar one:
https://www.debian-administration.or..._kernel_module


Ps. I havent yet tried any of the methods and I am not using any of the above mentioned systems. I am using Mageia and a custom kernel and would probably recompile if needed.

Last edited by zeebra; 09-24-2013 at 06:55 AM.
 
Old 09-24-2013, 07:27 AM   #13
billvance
Member
 
Registered: Sep 2013
Location: Bothell, Washington USA
Distribution: Kubuntu 12.04
Posts: 57

Original Poster
Rep: Reputation: Disabled
ok, here's what the command did, stopping at a
#include in one of the missing files I finally managed to get.

gcc -o driver stk1160-v4l.c
stk1160-v4l.c:23:27: fatal error: linux/module.h: No such file or directory
compilation terminated.

And here's the README.md file.

IMPORTANT UPDATE
================

Completely deprecated, this driver is.
(Yoda)

The driver you are looking at is for Linux v3.2 **only**.
It will **not** work on any other kernel version. Please don't even
try unless you really know what you're doing.

Given stk1160 is fully mainlined since Linux v3.7 I've disabled issue tracking
for this github repository. If you have questions or want to report a bug
please use the video4linux mailing list (linux-media@vger.kernel.org) or
try asking in the IRC channel (#v4l).

If you want to stay updated with news about easycap devices you can
read the most excellent blog from Andrew Schalk.

http://easycap.blogspot.com.ar/

I hope you enjoy using stk1160 as much as I've enjoyed writing it!

stk1160-standalone
==================

stk1160 release 0.9.3\_for\_v3.2

This branch is intended to be used with v3.2.
__Please don't even try to use it with another one__.

This is the stk1160 driver (formerly known as easycap driver).
It's the driver needed to capture audio and video in some of those
little devices named as Easycap (if they are based on stk1160 chip).

You need to have this modules installed, but don't worry,
you don't have to insert them manually:

- snd\_usb\_audio
- snd\_ac97\_codec
- ac97\_bus
- saa7115
- videodev
- videobuf2\_core
- videobuf2\_vmalloc
- videobuf2\_memops
- v4l2\_common

Building and installing
-----------------------

make
make install

After this, perhaps you will have to run 'depmod -a'.

You should *not* get any warning.
If you do, most probably you did something wrong or you're using an incompatible kernel.

Usage
-----

After installing the driver you're ready to go.
If you now insert your usb easycap device you'll notice two modules get automatically loaded:
stk1160 and snd-usb-audio.
This can be seen using dmesg:

$ dmesg | grep registered
[48.561592] stk1160 2-2:1.0: V4L2 device registered as video0
[48.562284] usbcore: registered new interface driver stk1160
[49.169189] usbcore: registered new interface driver snd-usb-audio

Also, stk1160 will register a control-only alsa sound card.
This sound card is called 'stk1160-mixer'.
To enable sound capture you have to open alsamixer and selected
the 'Line' item on the capture menu for stk1160-mixer device.

This stk1160-mixer device is needed because snd-usb-audio
doesn't show mixer controls for the ac97 codec chip.
The real usb transfer for audio capture is done through snd-usb-audio.

Preventing old easycap driver from loading
------------------------------------------

If you want to prevent some module from loading
you can do so by adding it to blacklist file.

On many distributions this can be done like this:

echo "blacklist easycap" >> /etc/modprobe.d/blacklist.conf

This way easycap won't be loaded automatically by udev;
you can still load it manually, of course.
 
Old 09-24-2013, 01:45 PM   #14
odiseo77
Senior Member
 
Registered: Dec 2004
Location: Caracas, Venezuela
Distribution: Debian Sid, OpenSUSE 13.2
Posts: 1,147

Rep: Reputation: 506Reputation: 506Reputation: 506Reputation: 506Reputation: 506Reputation: 506
Umm, the readme is not clear. I navigated through the website linked in the readme, but couldn't find clear instructions. You probably need to install the kernel headers for your kernel, but without a makefile, I have no idea how to compile the driver. Sorry I can't help; maybe a more experienced user could tell us how to compile it (in case they know how to do it).
 
Old 09-24-2013, 05:27 PM   #15
turtleli
Member
 
Registered: Aug 2012
Location: UK
Posts: 206

Rep: Reputation: Disabled
Your first problem is that you are missing most of the driver. Including the README you have 2 out of the 9 files.

Go to the stk1160 github, download all the files(don't keep the files you currently have) there and then see whether make will work.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Errors while compiling an example from Linux Device Drivers MrBonev Programming 3 01-11-2014 03:39 PM
linux device drivers : how can i unregister a character device ? zampa Linux - General 5 06-21-2012 06:34 AM
[SOLVED] URGENT : How to handle one device through two separted device drivers Khadidja Linux - Kernel 2 02-16-2011 03:33 AM
Compiling Device Driver in Linux i_love_linux Linux - Kernel 13 09-04-2007 10:24 AM
Compiling device-3dfx darkfnord Linux - Newbie 0 09-16-2002 01:04 AM


All times are GMT -5. The time now is 08:02 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration