Re: Linux Device Driver

2014-05-06 Thread Robert P. J. Day
On Mon, 5 May 2014, Sima Baymani wrote:

 Rumours say an updated version of LDD3 is coming, due to be published this 
 autumn:
 http://www.amazon.com/Linux-Device-Drivers-Jessica-McKellar/dp/1449371612/ref=sr_1_1?s=booksie=UTF8qid=13988
 59695sr=1-1keywords=linux+device+drivers

 Happy days =)

  after checking with the powers-that-be, i can confirm that, yes,
there is an upcoming LDD4, as you can see from that amazon page.

rday

-- 


Robert P. J. Day Ottawa, Ontario, CANADA
http://crashcourse.ca

Twitter:   http://twitter.com/rpjday
LinkedIn:   http://ca.linkedin.com/in/rpjday


___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Query on improving ADV driver 7180

2014-05-06 Thread sanchayan maity
Hello,

I am currently using ADV7180 as a video decoder and using to view any one
of the four video channel inputs.

The driver is here:
http://lxr.free-electrons.com/source/drivers/media/video/adv7180.c?v=3.0

The details for the decoder are here:
http://www.analog.com/en/audiovideo-products/video-decoders/adv7180/products/product.html

I am trying to display two or four channels simultaneously in different
windows. The problem is that even with two windows the frame rate is not
acceptable. I am using the below code with OpenCV for rendering to multiple
windows. ioctl call is use to switch between the multiple channels.

#include opencv2/objdetect/objdetect.hpp
#include opencv2/highgui/highgui.hpp
#include opencv2/imgproc/imgproc.hpp
#include linux/videodev2.h
#include i2c-dev.h
#include fcntl.h
#include iostream
#include stdio.h
#include errno.h
#include unistd.h
#include sys/ioctl.h
#include string.h
#include pthread.h
#include queue
#include X11/Xlib.h
#include X11/Xutil.h

#define MAX4586_I2C_ADDR0x37
#define RENDER_DELAY80
#define SWITCH_DELAY60

using namespace std;
using namespace cv;

queueMat window1Queue;
queueMat window2Queue;
pthread_t render1Thread;
pthread_t render2Thread;

void *renderToWindow1(void *arg)
{
while (true)
{
if(!window1Queue.empty())
{
imshow(Window 1, window1Queue.front());
window1Queue.pop();
}
usleep(RENDER_DELAY);
}
}

void *renderToWindow2(void *arg)
{
while (true)
{
if(!window2Queue.empty())
{
imshow(Window 2, window2Queue.front());
window2Queue.pop();
}
usleep(RENDER_DELAY);
}
}


/** @function main */
int main(int argc, const char** argv)
{
int fd, retVal;
intcounter = 1, maxChannel = 0;
VideoCapture capture;
Mat frame;

fd = open(/dev/video0, O_RDWR);
if (fd  0)
{
perror(Failed to open\n);
return -1;
}

try
{
// Surround the OpenCV call by a try/catch block so we can give a
useful error message!
capture.open(0);
/**/
capture.set(CV_CAP_PROP_FRAME_WIDTH, 320);
capture.set(CV_CAP_PROP_FRAME_HEIGHT, 240);
/**/
}
catch (cv::Exception e)
{

}

if (!capture.isOpened())
{
cerr  ERROR: Could not access the camera!  endl;
exit(1);
}

pthread_create(render1Thread, NULL, renderToWindow1, NULL);

pthread_create(render2Thread, NULL, renderToWindow2, NULL);

while(true)
 {
switch(counter)
{
case 1:
maxChannel = 0;
if (ioctl(fd, VIDIOC_S_INPUT, maxChannel)  0)
{
 perror(1. Failed ioctl\n);
}

counter = 3;
capture  frame;
if(!frame.empty())
{
window1Queue.push(frame);
}
break;

case 2:
break;

case 3:
maxChannel = 2;
if (ioctl(fd, VIDIOC_S_INPUT, maxChannel)  0)
{
 perror(2. Failed ioctl\n);
}
counter = 1;
capture  frame;
if(!frame.empty())
{
window2Queue.push(frame);
}
break;

case 4:
break;

default:
counter = 1;
break;
}

waitKey(SWITCH_DELAY);
}

return 0;
 }

I am suspecting that the ioctl call, is one thing which take some time
here, due to the copy required from user space to kernel space. Can the
timing be improved with a mmap implementation in the driver, removing the
implicit copy from user space to kernel space, giving me a decent frame
rate for multi window rendering?

The waitKey(SWITCH_DELAY) provides a delay without which the frames glitch
badly and usleep(RENDER_DELAY) provides the necessary delay for rendering
to the window.

Thanks  Regards,
Sanchayan Maity.
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Developing a Linux driver using a USB sniffer

2014-05-06 Thread Luca Ellero
Il 05/05/2014 22:39, Dave Hylands wrote:
 Hi Luca,

 On Mon, May 5, 2014 at 5:06 AM, Luca Ellero lro...@gmail.com 
 mailto:lro...@gmail.com wrote:
 
  Hi all,
  can someone please tell me if it is legal to develop an USB driver
  analysing the USB protocol with a USB sniffer?
  Can this driver be made public under GPL?

 Just though I'd point out that WireShark http://www.wireshark.org/ 
 already has usb sniffing builtin 
 http://wiki.wireshark.org/CaptureSetup/USB It uses the usbmon which is 
 already part of the kernel
 https://www.kernel.org/doc/Documentation/usb/usbmon.txt

 --
 Dave Hylands
 Shuswap, BC, Canada
 http://www.davehylands.com

Thanks to all for the replies ,
regards
Luca

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Linux Device Driver

2014-05-06 Thread Saurabh Jain
Hey , thank u so much for ur reply thanx for help


On Tue, May 6, 2014 at 2:20 PM, Robert P. J. Day rpj...@crashcourse.cawrote:

 On Mon, 5 May 2014, Sima Baymani wrote:

  Rumours say an updated version of LDD3 is coming, due to be published
 this autumn:
 
 http://www.amazon.com/Linux-Device-Drivers-Jessica-McKellar/dp/1449371612/ref=sr_1_1?s=booksie=UTF8qid=13988
  59695sr=1-1keywords=linux+device+drivers
 
  Happy days =)

   after checking with the powers-that-be, i can confirm that, yes,
 there is an upcoming LDD4, as you can see from that amazon page.

 rday

 --

 
 Robert P. J. Day Ottawa, Ontario, CANADA
 http://crashcourse.ca

 Twitter:   http://twitter.com/rpjday
 LinkedIn:   http://ca.linkedin.com/in/rpjday
 

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Developing a Linux driver using a USB sniffer

2014-05-06 Thread Eric Fowler
Yes to all of that. But IANAL. You cannot MARKET a DEVICE without paying
The Man, as it were. But as far as I know, but aren't coming for the driver
writers..yet.
On May 5, 2014 5:14 AM, Luca Ellero lro...@gmail.com wrote:

 Hi all,
 can someone please tell me if it is legal to develop an USB driver
 analysing the USB protocol with a USB sniffer?
 Can this driver be made public under GPL?
 Thanks
 Regards
 Luca Ellero

 ___
 Kernelnewbies mailing list
 Kernelnewbies@kernelnewbies.org
 http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


LKML: Dropped mail fanout?

2014-05-06 Thread David Matlack
Hey fellow kernelnewbies.

I sent a patch series to LKML last night from my work email address. I'm also
subscribed to LKML from my personal email address (this one)... but I haven't
received the patches on my personal account yet.

The patch series is here: https://lkml.org/lkml/2014/5/6/1. So it was delivered
to LKML. But maybe the fanout failed. The messages are _not_ in my spam or
trash folders. I don't think they were delivered at all.

If anyone would be willing to give a Yes/No if they received the patches on
LKML that would be a big help for debugging this. Also, if anyone has any other
tips let me know :)

Thanks!
--David

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: LKML: Dropped mail fanout?

2014-05-06 Thread Valdis . Kletnieks
On Tue, 06 May 2014 15:51:15 -0700, David Matlack said:

 The patch series is here: https://lkml.org/lkml/2014/5/6/1. So it was 
 delivered
 to LKML. But maybe the fanout failed. The messages are _not_ in my spam or
 trash folders. I don't think they were delivered at all.

If you posted it with your gmail account, be aware that GMail does duplicate
suppression based on the Message-ID: header.  The gotcha is that if you posted
it via GMail, then GMail saw that Message-ID: on the way *out* (when it copied
it to your outbox), so the copy coming back from the list gets suppressed and
doesn't make it to your inbox, spam, or trash folders.


pgp1IVeA_tnuM.pgp
Description: PGP signature
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: LKML: Dropped mail fanout?

2014-05-06 Thread David Matlack
On Tue, May 6, 2014 at 4:36 PM,  valdis.kletni...@vt.edu wrote:

 If you posted it with your gmail account, be aware that GMail does duplicate
 suppression based on the Message-ID: header.

I actually posted it from my work address (not gmail) and I see it in my outbox
there.

I guess it's an issue with my gmail account. But I'm curious if any folks with
@gmail.com addresses did receive the patches.

--David

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: LKML: Dropped mail fanout?

2014-05-06 Thread Martin Kepplinger
Am 2014-05-07 03:53, schrieb David Matlack:
 On Tue, May 6, 2014 at 4:36 PM,  valdis.kletni...@vt.edu wrote:

 If you posted it with your gmail account, be aware that GMail does duplicate
 suppression based on the Message-ID: header.
 
 I actually posted it from my work address (not gmail) and I see it in my 
 outbox
 there.
 
 I guess it's an issue with my gmail account. But I'm curious if any folks with
 @gmail.com addresses did receive the patches.
 
 --David

It doesn't have anything to do with gmail but fwiw I got unsubscribed
from lkml a few days ago. I didn't get any mail anymore, gut suspicious,
unsubscribed and got the answer that I wasn't subscribed at all.
Resubscribed and it's fine again. still weird.


___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies