Want more features on Pastebin? Sign Up, it's FREE!
Guest

stephan

By: a guest on Dec 5th, 2010  |  syntax: None  |  size: 6.16 KB  |  views: 160  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. diff -Naur a/driver_src/Makefile b/driver_src/Makefile
  2. --- a/driver_src/Makefile       2008-06-12 17:26:55.000000000 +0200
  3. +++ b/driver_src/Makefile       2010-11-21 03:58:15.000000000 +0100
  4. @@ -1,2 +1,15 @@
  5. -obj-m := smartcam.o
  6. +obj-m  := smartcam.o
  7.  
  8. +PWD    := $(shell pwd)
  9. +KDIR   := /lib/modules/$(shell uname -r)/build
  10. +
  11. +all:
  12. +       make -C $(KDIR) M=$(PWD) modules
  13. +
  14. +clean:
  15. +       rm -f *~ Module.symvers Module.markers modules.order
  16. +       make -C $(KDIR) M=$(PWD) clean
  17. +
  18. +install: all
  19. +       make -C $(KDIR) M=$(PWD) modules_install
  20. +       depmod -a
  21. diff -Naur a/driver_src/smartcam.c b/driver_src/smartcam.c
  22. --- a/driver_src/smartcam.c     2009-07-08 18:28:55.000000000 +0200
  23. +++ b/driver_src/smartcam.c     2010-11-24 01:23:58.000000000 +0100
  24. @@ -35,6 +35,7 @@
  25.  #include <media/v4l2-dev.h>
  26.  #include <linux/version.h>
  27.  //#include <linux/videodev2.h>
  28. +#include <linux/sched.h>
  29.  
  30.  #ifdef CONFIG_VIDEO_V4L1_COMPAT
  31.  /* Include V4L1 specific functions. Should be removed soon */
  32. @@ -169,7 +170,7 @@
  33.                 }
  34.         }
  35.  
  36. -       printk(KERN_ALERT "smartcam (%s): vidioc_s_fmt_cap called\n\t\twidth=%d; \
  37. +       SCAM_MSG("smartcam (%s): vidioc_s_fmt_cap called\n\t\twidth=%d; \
  38.  height=%d; pixelformat=%s\n\t\tfield=%d; bytesperline=%d; sizeimage=%d; colspace = %d; return EINVAL\n",
  39.         current->comm, f->fmt.pix.width, f->fmt.pix.height, (char*)&f->fmt.pix.pixelformat,
  40.         f->fmt.pix.field, f->fmt.pix.bytesperline, f->fmt.pix.sizeimage, f->fmt.pix.colorspace);
  41. @@ -242,11 +243,7 @@
  42.                 SCAM_MSG("vidioc_querybuf called - invalid buf type\n");
  43.                 return -EINVAL;
  44.         }
  45. -       if(vidbuf->memory != V4L2_MEMORY_MMAP)
  46. -       {
  47. -               SCAM_MSG("vidioc_querybuf called - invalid memory type\n");
  48. -               return -EINVAL;
  49. -       }
  50. +       vidbuf->memory = V4L2_MEMORY_MMAP;
  51.         vidbuf->length = SMARTCAM_BUFFER_SIZE;
  52.         vidbuf->bytesused = formats[format].sizeimage;
  53.         vidbuf->flags = V4L2_BUF_FLAG_MAPPED;
  54. @@ -538,7 +535,7 @@
  55.  {
  56.         int mask = (POLLOUT | POLLWRNORM);      /* writable */
  57.         if (last_read_frame != frame_sequence)
  58. -           mask |= (POLLIN | POLLRDNORM)       /* readable */
  59. +           mask |= (POLLIN | POLLRDNORM);      /* readable */
  60.  
  61.         SCAM_MSG("(%s) %s called\n", current->comm, __FUNCTION__);
  62.  
  63. @@ -553,7 +550,7 @@
  64.         return 0;
  65.  }
  66.  
  67. -static const struct file_operations smartcam_fops = {
  68. +static const struct v4l2_file_operations smartcam_fops = {
  69.         .owner          = THIS_MODULE,
  70.         .open           = smartcam_open,
  71.         .release        = smartcam_release,
  72. @@ -562,7 +559,6 @@
  73.         .poll           = smartcam_poll,
  74.         .ioctl          = video_ioctl2, /* V4L2 ioctl handler */
  75.         .mmap           = smartcam_mmap,
  76. -       .llseek         = no_llseek,
  77.  };
  78.  
  79.  static const struct v4l2_ioctl_ops smartcam_ioctl_ops = {
  80. @@ -596,7 +592,7 @@
  81.  
  82.  static struct video_device smartcam_vid = {
  83.         .name           = "smartcam",
  84. -       .vfl_type               = VID_TYPE_CAPTURE,
  85. +       //.vfl_type     = VID_TYPE_CAPTURE,
  86.         //.hardware     = 0,
  87.         .fops           = &smartcam_fops,
  88.         .minor          = -1,
  89. diff -Naur a/ReadMe.txt b/ReadMe.txt
  90. --- a/ReadMe.txt        2009-07-08 18:31:31.000000000 +0200
  91. +++ b/ReadMe.txt        2010-11-21 03:58:15.000000000 +0100
  92. @@ -3,12 +3,12 @@
  93.  
  94.  1. Installation/compilation on PC
  95.  
  96. -Install the .deb file; to install from source: ./configure make & make install
  97. +Install the .deb file; to install from source: ./configure, make & make install
  98.  
  99. -To compile and install the driver: download the src package from sorceforge and
  100. +To compile and install the driver: download the src package from sourceforge and
  101.  from the driver_src directory type:
  102.  
  103. -make -C /lib/modules/`uname -r`/build M=`pwd`
  104. +make & make install
  105.  
  106.  After successfully compiling the driver you should have the file smartcam.ko.
  107.  
  108. @@ -20,10 +20,9 @@
  109.  3. Running
  110.  
  111.  Before running smartcam, the driver must be loaded in the kernel; if not the PC application is
  112. -pretty much useless. To load the driver, open a shell as root in src/driver path and type:
  113. +pretty much useless. To load the driver, open a shell as root and type:
  114.  
  115. -       /sbin/modprobe videodev
  116. -       /sbin/insmod smartcam.ko
  117. +       modprobe smartcam
  118.  
  119.  After this start the application on the PC, start the phone application and connect it to your PC.
  120.  You should now see video images on the PC application window.
  121. diff -Naur a/src/CommHandler.cpp b/src/CommHandler.cpp
  122. --- a/src/CommHandler.cpp       2009-07-07 18:48:31.000000000 +0200
  123. +++ b/src/CommHandler.cpp       2010-11-24 01:36:03.000000000 +0100
  124. @@ -114,13 +114,16 @@
  125.      *rfcomm_list = 0,
  126.      *root_list = 0,
  127.      *proto_list = 0,
  128. -    *access_proto_list = 0;
  129. +    *access_proto_list = 0,
  130. +    *svc_class_list = 0;
  131.      sdp_data_t* channel = 0, *psm = 0;
  132.  
  133.      sdpRecord = sdp_record_alloc();
  134.  
  135. -    // set the general service ID
  136. +    // set the general service class list and service ID
  137.      sdp_uuid128_create(&svc_uuid, &svc_uuid_int);
  138. +    svc_class_list = sdp_list_append(0, &svc_uuid);
  139. +    sdp_set_service_classes(sdpRecord, svc_class_list);
  140.      sdp_set_service_id(sdpRecord, svc_uuid);
  141.  
  142.      // make the service record publicly browsable
  143. @@ -151,10 +154,14 @@
  144.  
  145.      // connect to the local SDP server, register the service record
  146.      sdpSession = sdp_connect(BDADDR_ANY, BDADDR_LOCAL, SDP_RETRY_IF_BUSY);
  147. -    err = sdp_record_register(sdpSession, sdpRecord, 0);
  148. -    if(err)
  149. -    {
  150. -        perror("sdp_record_register");
  151. +    if (sdpSession == NULL) {
  152. +        perror("sdp_connect");
  153. +    } else {  
  154. +        err = sdp_record_register(sdpSession, sdpRecord, 0);
  155. +        if(err)
  156. +        {
  157. +            perror("sdp_record_register");
  158. +        }
  159.      }
  160.  
  161.      // cleanup
  162. @@ -162,15 +169,17 @@
  163.      sdp_list_free(l2cap_list, 0);
  164.      sdp_list_free(rfcomm_list, 0);
  165.      sdp_list_free(root_list, 0);
  166. +    sdp_list_free(proto_list, 0);
  167.      sdp_list_free(access_proto_list, 0);
  168. +    sdp_list_free(svc_class_list, 0);
  169.  }
  170.  
  171.  int CCommHandler::DynamicBtBind(int sock, struct sockaddr_rc* sockaddr, uint8_t* port)
  172.  {
  173.      int status = 0;
  174. -    for(*port = 1; *port <= 30; *port++)
  175. +    for(*port = 1; *port <= 30; (*port)++)
  176.      {
  177. -        sockaddr->rc_channel = htons(*port);
  178. +        sockaddr->rc_channel = *port;
  179.          status = bind(sock, (struct sockaddr*) sockaddr, sizeof(*sockaddr));
  180.          if(status == 0)
  181.              return 0;
  182. @@ -331,7 +340,7 @@
  183.  
  184.  void CCommHandler::StopServer()
  185.  {
  186. -    if(sdpRecord != NULL)
  187. +    if(sdpRecord != NULL && sdpSession != NULL)
  188.      {
  189.          sdp_record_unregister(sdpSession, sdpRecord);
  190.          sdpRecord = NULL;
clone this paste RAW Paste Data