Patch against kernel 3.0 for Stretch SDK 6.0

Stretch-SDK-linux-v6.0.0_20110302-kernel-3.0.0.patch
diff --git a/src/host/apps/dvrcp/dvrcp.pro b/src/host/apps/dvrcp/dvrcp.pro
index ed17039..93a9d91 100644
--- a/src/host/apps/dvrcp/dvrcp.pro
+++ b/src/host/apps/dvrcp/dvrcp.pro
@@ -21,7 +21,7 @@ CONFIG(debug, debug|release) {
 unix:QMAKE_LFLAGS += -Wl,-rpath,\\\$$ORIGIN/../lib/so
 
 !exists($${SDK_LIB}/libsdvr_dummy_ui_sdk.a){
-unix:LIBS += -L$${SDK_LIB}/so -L$${SDK_LIB} -lsdvr_sdk -lsdvr_ui_sdk -lsct -lsvcext_lib -lmp4lib -laio -lrt -lXv
+unix:LIBS += -L$${SDK_LIB}/so -L$${SDK_LIB} -lsdvr_sdk -lsdvr_ui_sdk -lsct -lsvcext_lib -lmp4lib -laio -lrt -lXv -lX11 -lXext
 }else{
 unix:LIBS += -L$${SDK_LIB}/so -L$${SDK_LIB} -lsdvr_sdk -lsdvr_dummy_ui_sdk -lsdvr_vfb_sdk -lsct -lsvcext_lib -lmp4lib -laio -lrt 
 DEFINES += EMBEDDED_DVR
diff --git a/src/host/apps/sdk_training/get_capabilities/get_capabilities.cpp b/src/host/apps/sdk_training/get_capabilities/get_capabilities.cpp
index a8c9105..c4041a3 100644
--- a/src/host/apps/sdk_training/get_capabilities/get_capabilities.cpp
+++ b/src/host/apps/sdk_training/get_capabilities/get_capabilities.cpp
@@ -20,6 +20,22 @@ main(int argc, char *argv[])
     {
 	printf("Board %d\n", i);
 
+	sdvr_pci_attrib_t pci_attrib;
+	err_ret = sdvr_get_pci_attrib(i, &pci_attrib);
+	assert(!err_ret);
+
+	printf("  pci slot = %d\n", pci_attrib.pci_slot_num);
+	printf("  board type = %d\n", pci_attrib.board_type);
+	printf("  vendor id = %d\n", pci_attrib.vendor_id);
+	printf("  device id = %d\n", pci_attrib.device_id);
+	printf("  subsystem vendor = %d\n", pci_attrib.subsystem_vendor);
+	printf("  subsystem id = %d\n", pci_attrib.subsystem_id);
+	printf("  serial number = %s\n", pci_attrib.serial_number);
+
+	char* firmwares[] = {"/home/smartvideo/lanner/SDVR-linux-v6.0.0/firmware/vrc6004_dvrfw.rom"};
+	err_ret = sdvr_upgrade_firmware (i, firmwares[0]);
+	assert(!err_ret);
+
 	sdvr_board_config_t board_config;
 	err_ret = sdvr_get_board_config(i, &board_config);
 	assert(!err_ret);
@@ -34,7 +50,7 @@ main(int argc, char *argv[])
 
 	sdvr_board_settings_t board_settings;
 	memset(&board_settings, 0, sizeof(sdvr_board_settings_t)); 
-	board_settings.video_std = SDVR_VIDEO_STD_4CIF_NTSC;
+	board_settings.video_std = SDVR_VIDEO_STD_D1_PAL;
 	board_settings.is_h264_SCE = 1;
 	board_settings.audio_rate = SDVR_AUDIO_RATE_8KHZ;
 
diff --git a/src/host/src/driver/linux/drv_s6/module.mak b/src/host/src/driver/linux/drv_s6/module.mak
index a8fe927..4949c16 100644
--- a/src/host/src/driver/linux/drv_s6/module.mak
+++ b/src/host/src/driver/linux/drv_s6/module.mak
@@ -14,11 +14,11 @@ s6stretch-objs := ipcqueue.o \
 DBGFLAGS = -Werror
 EXTRA_CFLAGS += $(patsubst %, -I%,$(subst :, ,$(EXTRA_INC)))
 EXTRA_CFLAGS += $(DBGFLAGS)
-VER_COMP=$(shell expr $(SUBLEVEL) \< 20)
+VER_COMP=$(shell expr $(SUBLEVEL) \< 20 \|\| $(VERSION) > 2)
 ifeq ($(VER_COMP),1)
 EXTRA_CFLAGS += -DKVER_LESS_2620
 endif
-VER_COMP=$(shell expr $(SUBLEVEL) \< 17)
+VER_COMP=$(shell expr $(SUBLEVEL) \< 17 \|\| $(VERSION) > 2)
 ifeq ($(VER_COMP),1)
 EXTRA_CFLAGS += -DKVER_LESS_2617
 endif
diff --git a/src/host/src/driver/linux/drv_s6/stretch_main.c b/src/host/src/driver/linux/drv_s6/stretch_main.c
index 1e2e4de..2502cda 100644
--- a/src/host/src/driver/linux/drv_s6/stretch_main.c
+++ b/src/host/src/driver/linux/drv_s6/stretch_main.c
@@ -84,7 +84,7 @@ static const struct file_operations sx_fops =
     .aio_write  = sx_fops_async_read,
     .open       = sx_fops_open,
     .release    = sx_fops_release,
-    .ioctl      = sx_fops_ioctl,
+    .unlocked_ioctl      = sx_fops_ioctl,
     .owner      = THIS_MODULE,
 };
 
@@ -461,9 +461,8 @@ sx_fops_release(struct inode *inode,
 // Main FOPS ioctl call
 // Nothing PENDs here.
 //----------------------------------------
-int
-sx_fops_ioctl(struct inode *inode,
-              struct file  *file,
+long
+sx_fops_ioctl(struct file  *file,
               unsigned int  cmd,
               unsigned long arg)
 {
@@ -508,6 +507,7 @@ sx_fops_ioctl(struct inode *inode,
         case SX_IOCODE_IPC_QUEUE_INIT: /* none */
             xOS_PRINTK("==> IOCTL_IPC_QUEUE_INIT\n");
             pci_restore_state(stretch_dev->pci_resources.pcidev);
+	    pci_save_state(stretch_dev->pci_resources.pcidev);
             status = InitIPCQueue(stretch_dev, Irp);
             break;
 
@@ -531,6 +531,7 @@ sx_fops_ioctl(struct inode *inode,
         case SX_IOCODE_BOOT_FIRMWARE: /* input & output */
             xOS_PRINTK("=========> PCI_BOOT_BOARD\n");
             pci_restore_state(stretch_dev->pci_resources.pcidev);
+	    pci_save_state(stretch_dev->pci_resources.pcidev);
             status = PCIBoot(stretch_dev, Irp);
             status = Irp->size;
             CompleteRequest(Irp,&status);
@@ -915,6 +916,7 @@ _stretch_finidev(struct pci_dev *pcidev,
     case CLEANUP_ALL:
     case 8:
         pci_restore_state(pcidev);
+	pci_save_state(pcidev);
         pci_set_drvdata(pcidev, NULL);
         free_irq(pcidev->irq, stretch_dev);
         //releaseMsgHandlerThread(&stretch_dev->msg_handler);
diff --git a/src/host/src/driver/linux/drv_s6/stretch_main.h b/src/host/src/driver/linux/drv_s6/stretch_main.h
index 8734af4..3d110e5 100644
--- a/src/host/src/driver/linux/drv_s6/stretch_main.h
+++ b/src/host/src/driver/linux/drv_s6/stretch_main.h
@@ -201,9 +201,8 @@ sx_fops_release(struct inode *inode,
                 struct file  *file);
 
 // Main FOPS ioctl call
-int
-sx_fops_ioctl(struct inode *inode,
-              struct file *file,
+long
+sx_fops_ioctl(struct file *file,
               unsigned int cmd,
               unsigned long arg);
 

Exemple with VW-1104

$ uname -a
Linux clairvaux-video 3.0.0-1-686-pae #1 SMP Sat Aug 27 16:41:03 UTC 2011 i686 GNU/Linux
$ cd SDVR-linux-v6.0.0/src/host/apps/sdk_training/get_capabilities && make && ./get_capabilities
SDK version: 6.0.0.14
Board Count = 1

Board 0
Driver version: 6.0.0.2
  pci slot = 2
  board type = 413270020
  vendor id = 6306
  device id = 4
  subsystem vendor = 6306
  subsystem id = 0
  serial number = 
  num_cameras_supported = 4
  num_microphones_supported = 4
  has_smo = 1
  num_sensors = 8
  num_relay = 8
  camera_type = 1
  num_decoders_supported = 4
  num_smos = 1
  num_encoders_supported = 4
  num_audio_out_ports = 0
  num_emos = 0
enc buf num: 10
raw buf num: 2
dec buf num: 5
dec buf size: 262144
Firmware version: 6.0.0.23
         date: 2011-2-9
Bootloader version: 1.72
BSP version: 1.10
SMO 1
  video_formats = 0001
  width = 720
  height = 576
  cap_flags = 0010
Print/export