Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff -Naur a/driver_src/Makefile b/driver_src/Makefile
- --- a/driver_src/Makefile 2008-06-12 17:26:55.000000000 +0200
- +++ b/driver_src/Makefile 2010-11-21 03:58:15.000000000 +0100
- @@ -1,2 +1,15 @@
- -obj-m := smartcam.o
- +obj-m := smartcam.o
- +PWD := $(shell pwd)
- +KDIR := /lib/modules/$(shell uname -r)/build
- +
- +all:
- + make -C $(KDIR) M=$(PWD) modules
- +
- +clean:
- + rm -f *~ Module.symvers Module.markers modules.order
- + make -C $(KDIR) M=$(PWD) clean
- +
- +install: all
- + make -C $(KDIR) M=$(PWD) modules_install
- + depmod -a
- diff -Naur a/driver_src/smartcam.c b/driver_src/smartcam.c
- --- a/driver_src/smartcam.c 2009-07-08 18:28:55.000000000 +0200
- +++ b/driver_src/smartcam.c 2010-11-24 01:23:58.000000000 +0100
- @@ -35,6 +35,7 @@
- #include <media/v4l2-dev.h>
- #include <linux/version.h>
- //#include <linux/videodev2.h>
- +#include <linux/sched.h>
- #ifdef CONFIG_VIDEO_V4L1_COMPAT
- /* Include V4L1 specific functions. Should be removed soon */
- @@ -169,7 +170,7 @@
- }
- }
- - printk(KERN_ALERT "smartcam (%s): vidioc_s_fmt_cap called\n\t\twidth=%d; \
- + SCAM_MSG("smartcam (%s): vidioc_s_fmt_cap called\n\t\twidth=%d; \
- height=%d; pixelformat=%s\n\t\tfield=%d; bytesperline=%d; sizeimage=%d; colspace = %d; return EINVAL\n",
- current->comm, f->fmt.pix.width, f->fmt.pix.height, (char*)&f->fmt.pix.pixelformat,
- f->fmt.pix.field, f->fmt.pix.bytesperline, f->fmt.pix.sizeimage, f->fmt.pix.colorspace);
- @@ -242,11 +243,7 @@
- SCAM_MSG("vidioc_querybuf called - invalid buf type\n");
- return -EINVAL;
- }
- - if(vidbuf->memory != V4L2_MEMORY_MMAP)
- - {
- - SCAM_MSG("vidioc_querybuf called - invalid memory type\n");
- - return -EINVAL;
- - }
- + vidbuf->memory = V4L2_MEMORY_MMAP;
- vidbuf->length = SMARTCAM_BUFFER_SIZE;
- vidbuf->bytesused = formats[format].sizeimage;
- vidbuf->flags = V4L2_BUF_FLAG_MAPPED;
- @@ -538,7 +535,7 @@
- {
- int mask = (POLLOUT | POLLWRNORM); /* writable */
- if (last_read_frame != frame_sequence)
- - mask |= (POLLIN | POLLRDNORM) /* readable */
- + mask |= (POLLIN | POLLRDNORM); /* readable */
- SCAM_MSG("(%s) %s called\n", current->comm, __FUNCTION__);
- @@ -553,7 +550,7 @@
- return 0;
- }
- -static const struct file_operations smartcam_fops = {
- +static const struct v4l2_file_operations smartcam_fops = {
- .owner = THIS_MODULE,
- .open = smartcam_open,
- .release = smartcam_release,
- @@ -562,7 +559,6 @@
- .poll = smartcam_poll,
- .ioctl = video_ioctl2, /* V4L2 ioctl handler */
- .mmap = smartcam_mmap,
- - .llseek = no_llseek,
- };
- static const struct v4l2_ioctl_ops smartcam_ioctl_ops = {
- @@ -596,7 +592,7 @@
- static struct video_device smartcam_vid = {
- .name = "smartcam",
- - .vfl_type = VID_TYPE_CAPTURE,
- + //.vfl_type = VID_TYPE_CAPTURE,
- //.hardware = 0,
- .fops = &smartcam_fops,
- .minor = -1,
- diff -Naur a/ReadMe.txt b/ReadMe.txt
- --- a/ReadMe.txt 2009-07-08 18:31:31.000000000 +0200
- +++ b/ReadMe.txt 2010-11-21 03:58:15.000000000 +0100
- @@ -3,12 +3,12 @@
- 1. Installation/compilation on PC
- -Install the .deb file; to install from source: ./configure make & make install
- +Install the .deb file; to install from source: ./configure, make & make install
- -To compile and install the driver: download the src package from sorceforge and
- +To compile and install the driver: download the src package from sourceforge and
- from the driver_src directory type:
- -make -C /lib/modules/`uname -r`/build M=`pwd`
- +make & make install
- After successfully compiling the driver you should have the file smartcam.ko.
- @@ -20,10 +20,9 @@
- 3. Running
- Before running smartcam, the driver must be loaded in the kernel; if not the PC application is
- -pretty much useless. To load the driver, open a shell as root in src/driver path and type:
- +pretty much useless. To load the driver, open a shell as root and type:
- - /sbin/modprobe videodev
- - /sbin/insmod smartcam.ko
- + modprobe smartcam
- After this start the application on the PC, start the phone application and connect it to your PC.
- You should now see video images on the PC application window.
- diff -Naur a/src/CommHandler.cpp b/src/CommHandler.cpp
- --- a/src/CommHandler.cpp 2009-07-07 18:48:31.000000000 +0200
- +++ b/src/CommHandler.cpp 2010-11-24 01:36:03.000000000 +0100
- @@ -114,13 +114,16 @@
- *rfcomm_list = 0,
- *root_list = 0,
- *proto_list = 0,
- - *access_proto_list = 0;
- + *access_proto_list = 0,
- + *svc_class_list = 0;
- sdp_data_t* channel = 0, *psm = 0;
- sdpRecord = sdp_record_alloc();
- - // set the general service ID
- + // set the general service class list and service ID
- sdp_uuid128_create(&svc_uuid, &svc_uuid_int);
- + svc_class_list = sdp_list_append(0, &svc_uuid);
- + sdp_set_service_classes(sdpRecord, svc_class_list);
- sdp_set_service_id(sdpRecord, svc_uuid);
- // make the service record publicly browsable
- @@ -151,10 +154,14 @@
- // connect to the local SDP server, register the service record
- sdpSession = sdp_connect(BDADDR_ANY, BDADDR_LOCAL, SDP_RETRY_IF_BUSY);
- - err = sdp_record_register(sdpSession, sdpRecord, 0);
- - if(err)
- - {
- - perror("sdp_record_register");
- + if (sdpSession == NULL) {
- + perror("sdp_connect");
- + } else {
- + err = sdp_record_register(sdpSession, sdpRecord, 0);
- + if(err)
- + {
- + perror("sdp_record_register");
- + }
- }
- // cleanup
- @@ -162,15 +169,17 @@
- sdp_list_free(l2cap_list, 0);
- sdp_list_free(rfcomm_list, 0);
- sdp_list_free(root_list, 0);
- + sdp_list_free(proto_list, 0);
- sdp_list_free(access_proto_list, 0);
- + sdp_list_free(svc_class_list, 0);
- }
- int CCommHandler::DynamicBtBind(int sock, struct sockaddr_rc* sockaddr, uint8_t* port)
- {
- int status = 0;
- - for(*port = 1; *port <= 30; *port++)
- + for(*port = 1; *port <= 30; (*port)++)
- {
- - sockaddr->rc_channel = htons(*port);
- + sockaddr->rc_channel = *port;
- status = bind(sock, (struct sockaddr*) sockaddr, sizeof(*sockaddr));
- if(status == 0)
- return 0;
- @@ -331,7 +340,7 @@
- void CCommHandler::StopServer()
- {
- - if(sdpRecord != NULL)
- + if(sdpRecord != NULL && sdpSession != NULL)
- {
- sdp_record_unregister(sdpSession, sdpRecord);
- sdpRecord = NULL;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement