diff -u -r -N wis-go7007-linux-0.9.8-5/apps/gorecord.c wis-go7007-linux-0.9.8-6/apps/gorecord.c --- wis-go7007-linux-0.9.8-5/apps/gorecord.c 2009-09-13 00:45:28.000000000 -0400 +++ wis-go7007-linux-0.9.8-6/apps/gorecord.c 2010-07-10 10:20:06.000000000 -0400 @@ -590,6 +590,8 @@ PUT_32(hdr + 12 + 12 + off, FOURCC("JUNK")); PUT_32(hdr + 12 + 12 + off + 4, 1024 - 12 - 12 - off - 8); PUT_32(hdr + 1024, FOURCC("LIST")); + /* AXJ -> movielen was uninitialized; I have set it to 0 which is probably wrong */ + movielen = 0; PUT_32(hdr + 1024 + 4, movielen - 1024 - 8); PUT_32(hdr + 1024 + 8, FOURCC("movi")); lseek(avifd, 0, SEEK_SET); diff -u -r -N wis-go7007-linux-0.9.8-5/go7007_firmware_load wis-go7007-linux-0.9.8-6/go7007_firmware_load --- wis-go7007-linux-0.9.8-5/go7007_firmware_load 2009-11-06 12:29:49.000000000 -0500 +++ wis-go7007-linux-0.9.8-6/go7007_firmware_load 2010-07-10 13:34:27.000000000 -0400 @@ -15,12 +15,6 @@ exit 1 fi -## fxload needs usbfs -#if [ ! -d "/dev/bus/usb" ] || [ ! "$(ls /proc/bus/usb)" ]; then -# echo "ERROR: Make sure usbfs|usbdevfs is mounted on /proc/bus/usb" -# exit 1 -#fi - # get the bus number bus=`echo $device | cut -d " " -f 2` # get the device number @@ -29,11 +23,25 @@ type=`echo $device | cut -d " " -f 6 | tr A-Z a-z` # match the type with it's firmware -[ $type == "093b:a002" ] && hex="/lib/firmware/ezusb/hpi_PX-M402U.hex" -[ $type == "093b:a004" ] && hex="/lib/firmware/ezusb/hpi_PX-TV402U.hex" -[ $type == "0eb1:6666" ] && hex="/lib/firmware/ezusb/hpi_LR192.hex" -[ $type == "0eb1:6668" ] && hex="/lib/firmware/ezusb/hpi_StarTrek.hex" +case "$type" in + "093b:a002") + hex="/lib/firmware/ezusb/hpi_PX-M402U.hex" + ;; + "093b:a004") + hex="/lib/firmware/ezusb/hpi_PX-TV402U.hex" + ;; + "0eb1:6666") + hex="/lib/firmware/ezusb/hpi_LR192.hex" + ;; + "0eb1:6668") + hex="/lib/firmware/ezusb/hpi_StarTrek.hex" + ;; + *) + echo "Device vendor id $type does not have available firmware" + ;; +esac +echo "Firmware file = $hex" if /sbin/fxload -t fx2 -I $hex -D /dev/bus/usb/"$bus"/"$device_num"; then echo 'Firmware loaded successfully!' diff -u -r -N wis-go7007-linux-0.9.8-5/kernel/go7007-driver.c wis-go7007-linux-0.9.8-6/kernel/go7007-driver.c --- wis-go7007-linux-0.9.8-5/kernel/go7007-driver.c 2009-09-13 01:37:02.000000000 -0400 +++ wis-go7007-linux-0.9.8-6/kernel/go7007-driver.c 2010-07-10 09:45:40.000000000 -0400 @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include #include #include @@ -140,9 +140,9 @@ { int ret; - down(&go->hw_lock); + mutex_lock(&go->hw_lock); ret = go7007_load_encoder(go); - up(&go->hw_lock); + mutex_unlock(&go->hw_lock); if (ret < 0) return -1; if (!init_i2c) @@ -257,9 +257,9 @@ printk(KERN_INFO "go7007: registering new %s\n", go->name); - down(&go->hw_lock); + mutex_lock(&go->hw_lock); ret = go7007_init_encoder(go); - up(&go->hw_lock); + mutex_unlock(&go->hw_lock); if (ret < 0) return -1; @@ -619,7 +619,7 @@ go->tuner_type = -1; go->channel_number = 0; go->name[0] = 0; - init_MUTEX(&go->hw_lock); + mutex_init(&go->hw_lock); init_waitqueue_head(&go->frame_waitq); spin_lock_init(&go->spinlock); go->video_dev = NULL; diff -u -r -N wis-go7007-linux-0.9.8-5/kernel/go7007-fw.c wis-go7007-linux-0.9.8-6/kernel/go7007-fw.c --- wis-go7007-linux-0.9.8-5/kernel/go7007-fw.c 2009-09-13 00:45:28.000000000 -0400 +++ wis-go7007-linux-0.9.8-6/kernel/go7007-fw.c 2010-07-10 10:10:05.000000000 -0400 @@ -31,6 +31,7 @@ #include #include #include +#include #include #include "go7007-priv.h" diff -u -r -N wis-go7007-linux-0.9.8-5/kernel/go7007-i2c.c wis-go7007-linux-0.9.8-6/kernel/go7007-i2c.c --- wis-go7007-linux-0.9.8-5/kernel/go7007-i2c.c 2009-09-13 00:45:28.000000000 -0400 +++ wis-go7007-linux-0.9.8-6/kernel/go7007-i2c.c 2010-07-10 09:59:00.000000000 -0400 @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include #include @@ -48,7 +48,7 @@ /* There is only one I2C port on the TW2804 that feeds all four GO7007 VIPs * on the Adlink PCI-MPG24, so access is shared between all of them. */ -static DECLARE_MUTEX(adlink_mpg24_i2c_lock); +static DEFINE_MUTEX(adlink_mpg24_i2c_lock); static int go7007_i2c_xfer(struct go7007 *go, u16 addr, int read, u16 command, int flags, u8 *data) @@ -69,11 +69,11 @@ *data, command, addr); #endif - down(&go->hw_lock); + mutex_lock(&go->hw_lock); if (go->board_id == GO7007_BOARDID_ADLINK_MPG24) { /* Bridge the I2C port on this GO7007 to the shared bus */ - down(&adlink_mpg24_i2c_lock); + mutex_lock(&adlink_mpg24_i2c_lock); go7007_write_addr(go, 0x3c82, 0x0020); } @@ -134,9 +134,9 @@ if (go->board_id == GO7007_BOARDID_ADLINK_MPG24) { /* Isolate the I2C port on this GO7007 from the shared bus */ go7007_write_addr(go, 0x3c82, 0x0000); - up(&adlink_mpg24_i2c_lock); + mutex_unlock(&adlink_mpg24_i2c_lock); } - up(&go->hw_lock); + mutex_unlock(&go->hw_lock); return ret; } diff -u -r -N wis-go7007-linux-0.9.8-5/kernel/go7007-priv.h wis-go7007-linux-0.9.8-6/kernel/go7007-priv.h --- wis-go7007-linux-0.9.8-5/kernel/go7007-priv.h 2009-09-13 00:45:28.000000000 -0400 +++ wis-go7007-linux-0.9.8-6/kernel/go7007-priv.h 2010-07-10 09:47:39.000000000 -0400 @@ -132,7 +132,7 @@ struct go7007_file { struct go7007 *go; - struct semaphore lock; + struct mutex lock; int buf_count; struct go7007_buffer *bufs; }; @@ -170,7 +170,7 @@ int ref_count; enum { STATUS_INIT, STATUS_ONLINE, STATUS_SHUTDOWN } status; spinlock_t spinlock; - struct semaphore hw_lock; + struct mutex hw_lock; int streaming; int in_use; int audio_enabled; @@ -240,7 +240,7 @@ unsigned short interrupt_data; }; -/* All of these must be called with the hpi_lock semaphore held! */ +/* All of these must be called with the hpi_lock mutex held! */ #define go7007_interface_reset(go) \ ((go)->hpi_ops->interface_reset(go)) #define go7007_write_interrupt(go, x, y) \ diff -u -r -N wis-go7007-linux-0.9.8-5/kernel/go7007-usb.c wis-go7007-linux-0.9.8-6/kernel/go7007-usb.c --- wis-go7007-linux-0.9.8-5/kernel/go7007-usb.c 2009-09-13 00:45:28.000000000 -0400 +++ wis-go7007-linux-0.9.8-6/kernel/go7007-usb.c 2010-07-10 09:49:30.000000000 -0400 @@ -62,7 +62,7 @@ struct go7007_usb { struct go7007_usb_board *board; - struct semaphore i2c_lock; + struct mutex i2c_lock; struct usb_device *usbdev; struct urb *video_urbs[8]; struct urb *audio_urbs[8]; @@ -734,7 +734,7 @@ static void go7007_usb_read_video_pipe_complete(struct urb *urb) { struct go7007 *go = (struct go7007 *)urb->context; - int r, status = urb-> status; + int r, status = urb->status; if (!go->streaming) { wake_up_interruptible(&go->frame_waitq); @@ -877,7 +877,7 @@ if (go->status == STATUS_SHUTDOWN) return -1; - down(&usb->i2c_lock); + mutex_lock(&usb->i2c_lock); for (i = 0; i < num; ++i) { /* The hardware command is "write some bytes then read some @@ -935,7 +935,7 @@ ret = 0; i2c_done: - up(&usb->i2c_lock); + mutex_unlock(&usb->i2c_lock); return ret; } @@ -1065,7 +1065,7 @@ if (board->flags & GO7007_USB_EZUSB_I2C) { memcpy(&go->i2c_adapter, &go7007_usb_adap_templ, sizeof(go7007_usb_adap_templ)); - init_MUTEX(&usb->i2c_lock); + mutex_init(&usb->i2c_lock); go->i2c_adapter.dev.parent = go->dev; i2c_set_adapdata(&go->i2c_adapter, go); if (i2c_add_adapter(&go->i2c_adapter) < 0) { diff -u -r -N wis-go7007-linux-0.9.8-5/kernel/go7007-v4l2.c wis-go7007-linux-0.9.8-6/kernel/go7007-v4l2.c --- wis-go7007-linux-0.9.8-5/kernel/go7007-v4l2.c 2009-09-13 00:49:34.000000000 -0400 +++ wis-go7007-linux-0.9.8-6/kernel/go7007-v4l2.c 2010-07-10 09:51:54.000000000 -0400 @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include #include @@ -75,7 +75,7 @@ int retval = -EINVAL; unsigned long flags; - down(&go->hw_lock); + mutex_lock(&go->hw_lock); if (go->streaming) { go->streaming = 0; go7007_stream_stop(go); @@ -85,7 +85,7 @@ go7007_reset_encoder(go); retval = 0; } - up(&go->hw_lock); + mutex_unlock(&go->hw_lock); return 0; } @@ -101,7 +101,7 @@ return -ENOMEM; ++go->ref_count; gofh->go = go; - init_MUTEX(&gofh->lock); + mutex_init(&gofh->lock); gofh->buf_count = 0; file->private_data = gofh; return 0; @@ -705,14 +705,14 @@ req->memory != V4L2_MEMORY_MMAP) return -EINVAL; - down(&gofh->lock); + mutex_lock(&gofh->lock); for (i = 0; i < gofh->buf_count; ++i) if (gofh->bufs[i].mapped > 0) goto unlock_and_return; - down(&go->hw_lock); + mutex_lock(&go->hw_lock); if (go->in_use > 0 && gofh->buf_count == 0) { - up(&go->hw_lock); + mutex_unlock(&go->hw_lock); goto unlock_and_return; } @@ -731,7 +731,7 @@ GFP_KERNEL); if (!gofh->bufs) { - up(&go->hw_lock); + mutex_unlock(&go->hw_lock); goto unlock_and_return; } @@ -750,8 +750,8 @@ } gofh->buf_count = count; - up(&go->hw_lock); - up(&gofh->lock); + mutex_unlock(&go->hw_lock); + mutex_unlock(&gofh->lock); memset(req, 0, sizeof(*req)); @@ -762,7 +762,7 @@ return 0; unlock_and_return: - up(&gofh->lock); + mutex_unlock(&gofh->lock); return retval; } @@ -778,7 +778,7 @@ index = buf->index; - down(&gofh->lock); + mutex_lock(&gofh->lock); if (index >= gofh->buf_count) goto unlock_and_return; @@ -802,12 +802,12 @@ buf->memory = V4L2_MEMORY_MMAP; buf->m.offset = index * GO7007_BUF_SIZE; buf->length = GO7007_BUF_SIZE; - up(&gofh->lock); + mutex_unlock(&gofh->lock); return 0; unlock_and_return: - up(&gofh->lock); + mutex_unlock(&gofh->lock); return retval; } @@ -824,7 +824,7 @@ buf->memory != V4L2_MEMORY_MMAP) return retval; - down(&gofh->lock); + mutex_lock(&gofh->lock); if (buf->index < 0 || buf->index >= gofh->buf_count) goto unlock_and_return; @@ -865,12 +865,12 @@ spin_lock_irqsave(&go->spinlock, flags); list_add_tail(&gobuf->stream, &go->stream); spin_unlock_irqrestore(&go->spinlock, flags); - up(&gofh->lock); + mutex_unlock(&gofh->lock); return 0; unlock_and_return: - up(&gofh->lock); + mutex_unlock(&gofh->lock); return retval; } @@ -890,7 +890,7 @@ if (buf->memory != V4L2_MEMORY_MMAP) return retval; - down(&gofh->lock); + mutex_lock(&gofh->lock); if (list_empty(&go->stream)) goto unlock_and_return; gobuf = list_entry(go->stream.next, @@ -934,11 +934,11 @@ buf->length = GO7007_BUF_SIZE; buf->reserved = gobuf->modet_active; - up(&gofh->lock); + mutex_unlock(&gofh->lock); return 0; unlock_and_return: - up(&gofh->lock); + mutex_unlock(&gofh->lock); return retval; } @@ -952,8 +952,8 @@ if (type != V4L2_BUF_TYPE_VIDEO_CAPTURE) return -EINVAL; - down(&gofh->lock); - down(&go->hw_lock); + mutex_lock(&gofh->lock); + mutex_lock(&go->hw_lock); if (!go->streaming) { go->streaming = 1; @@ -964,8 +964,8 @@ else retval = 0; } - up(&go->hw_lock); - up(&gofh->lock); + mutex_unlock(&go->hw_lock); + mutex_unlock(&gofh->lock); return retval; } @@ -978,9 +978,9 @@ if (type != V4L2_BUF_TYPE_VIDEO_CAPTURE) return -EINVAL; - down(&gofh->lock); + mutex_lock(&gofh->lock); go7007_streamoff(go); - up(&gofh->lock); + mutex_unlock(&gofh->lock); return 0; } @@ -1746,7 +1746,7 @@ return 0; /*unlock_and_return:*/ - /*up(&gofh->lock);*/ + /*mutex_unlock(&gofh->lock);*/ return retval; } @@ -1820,18 +1820,18 @@ return -EINVAL; /* only support VM_SHARED mapping */ if (vma->vm_end - vma->vm_start != GO7007_BUF_SIZE) return -EINVAL; /* must map exactly one full buffer */ - down(&gofh->lock); + mutex_lock(&gofh->lock); index = vma->vm_pgoff / GO7007_BUF_PAGES; if (index >= gofh->buf_count) { - up(&gofh->lock); + mutex_unlock(&gofh->lock); return -EINVAL; /* trying to map beyond requested buffers */ } if (index * GO7007_BUF_PAGES != vma->vm_pgoff) { - up(&gofh->lock); + mutex_unlock(&gofh->lock); return -EINVAL; /* offset is not aligned on buffer boundary */ } if (gofh->bufs[index].mapped > 0) { - up(&gofh->lock); + mutex_unlock(&gofh->lock); return -EBUSY; } gofh->bufs[index].mapped = 1; @@ -1840,7 +1840,7 @@ vma->vm_flags |= VM_DONTEXPAND; vma->vm_flags &= ~VM_IO; vma->vm_private_data = &gofh->bufs[index]; - up(&gofh->lock); + mutex_unlock(&gofh->lock); return 0; } @@ -1952,7 +1952,7 @@ { unsigned long flags; - down(&go->hw_lock); + mutex_lock(&go->hw_lock); if (go->streaming) { go->streaming = 0; go7007_stream_stop(go); @@ -1960,7 +1960,7 @@ abort_queued(go); spin_unlock_irqrestore(&go->spinlock, flags); } - up(&go->hw_lock); + mutex_unlock(&go->hw_lock); if (go->video_dev) video_unregister_device(go->video_dev); } diff -u -r -N wis-go7007-linux-0.9.8-5/kernel/s2250-board.c wis-go7007-linux-0.9.8-6/kernel/s2250-board.c --- wis-go7007-linux-0.9.8-5/kernel/s2250-board.c 2009-09-13 00:45:28.000000000 -0400 +++ wis-go7007-linux-0.9.8-6/kernel/s2250-board.c 2010-07-10 09:55:16.000000000 -0400 @@ -21,12 +21,10 @@ #include #include #include +#include "s2250-loader.h" #include "go7007-priv.h" #include "wis-i2c.h" -extern int s2250loader_init(void); -extern void s2250loader_cleanup(void); - #define TLV320_ADDRESS 0x34 #define VPX322_ADDR_ANALOGCONTROL1 0x02 #define VPX322_ADDR_BRIGHTNESS0 0x0127 @@ -43,7 +41,7 @@ struct go7007_usb { struct go7007_usb_board *board; - struct semaphore i2c_lock; + struct mutex i2c_lock; struct usb_device *usbdev; struct urb *video_urbs[8]; struct urb *audio_urbs[8]; @@ -165,7 +163,7 @@ return -ENOMEM; usb = go->hpi_context; - if (down_interruptible(&usb->i2c_lock) != 0) { + if (mutex_lock_interruptible(&usb->i2c_lock) != 0) { printk(KERN_INFO "i2c lock failed\n"); kfree(buf); return -EINTR; @@ -175,7 +173,7 @@ buf, 16, 1); - up(&usb->i2c_lock); + mutex_unlock(&usb->i2c_lock); kfree(buf); return rc; } @@ -203,14 +201,14 @@ memset(buf, 0xcd, 6); usb = go->hpi_context; - if (down_interruptible(&usb->i2c_lock) != 0) { + if (mutex_lock_interruptible(&usb->i2c_lock) != 0) { printk(KERN_INFO "i2c lock failed\n"); return -EINTR; } if (go7007_usb_vendor_request(go, 0x57, addr, val, buf, 16, 1) < 0) return -EFAULT; - up(&usb->i2c_lock); + mutex_unlock(&usb->i2c_lock); if (buf[0] == 0) { unsigned int subaddr, val_read; @@ -541,7 +539,7 @@ dec->audio_input = 0; write_reg(client, 0x08, 0x02); /* Line In */ - if (down_interruptible(&usb->i2c_lock) == 0) { + if (mutex_lock_interruptible(&usb->i2c_lock) == 0) { data = kzalloc(16, GFP_KERNEL); if (data != NULL) { int rc; @@ -560,7 +558,7 @@ } kfree(data); } - up(&usb->i2c_lock); + mutex_unlock(&usb->i2c_lock); } printk("s2250: initialized successfully\n"); diff -u -r -N wis-go7007-linux-0.9.8-5/kernel/s2250-loader.c wis-go7007-linux-0.9.8-6/kernel/s2250-loader.c --- wis-go7007-linux-0.9.8-5/kernel/s2250-loader.c 2009-09-13 00:45:28.000000000 -0400 +++ wis-go7007-linux-0.9.8-6/kernel/s2250-loader.c 2010-07-10 09:56:52.000000000 -0400 @@ -35,7 +35,7 @@ #define MAX_DEVICES 256 static pdevice_extension_t s2250_dev_table[MAX_DEVICES]; -static DECLARE_MUTEX(s2250_dev_table_mutex); +static DEFINE_MUTEX(s2250_dev_table_mutex); #define to_s2250loader_dev_common(d) container_of(d, device_extension_t, kref) static void s2250loader_delete(struct kref *kref) @@ -67,7 +67,7 @@ printk(KERN_ERR "can't handle multiple config\n"); return -1; } - down(&s2250_dev_table_mutex); + mutex_lock(&s2250_dev_table_mutex); for (minor = 0; minor < MAX_DEVICES; minor++) { if (s2250_dev_table[minor] == NULL) @@ -96,7 +96,7 @@ kref_init(&(s->kref)); - up(&s2250_dev_table_mutex); + mutex_unlock(&s2250_dev_table_mutex); if (request_firmware(&fw, S2250_LOADER_FIRMWARE, &usbdev->dev)) { printk(KERN_ERR @@ -128,7 +128,7 @@ return 0; failed: - up(&s2250_dev_table_mutex); + mutex_unlock(&s2250_dev_table_mutex); failed2: if (s) kref_put(&(s->kref), s2250loader_delete); diff -u -r -N wis-go7007-linux-0.9.8-5/kernel/snd-go7007.c wis-go7007-linux-0.9.8-6/kernel/snd-go7007.c --- wis-go7007-linux-0.9.8-5/kernel/snd-go7007.c 2009-09-13 00:45:28.000000000 -0400 +++ wis-go7007-linux-0.9.8-6/kernel/snd-go7007.c 2010-07-10 10:10:46.000000000 -0400 @@ -26,8 +26,9 @@ #include #include #include -#include +#include #include +#include #include #include #include diff -u -r -N wis-go7007-linux-0.9.8-5/kernel/wis-saa7113.c wis-go7007-linux-0.9.8-6/kernel/wis-saa7113.c --- wis-go7007-linux-0.9.8-5/kernel/wis-saa7113.c 2009-09-13 00:45:28.000000000 -0400 +++ wis-go7007-linux-0.9.8-6/kernel/wis-saa7113.c 2010-07-10 10:10:25.000000000 -0400 @@ -20,6 +20,7 @@ #include #include #include +#include #include "wis-i2c.h" diff -u -r -N wis-go7007-linux-0.9.8-5/kernel/wis-saa7115.c wis-go7007-linux-0.9.8-6/kernel/wis-saa7115.c --- wis-go7007-linux-0.9.8-5/kernel/wis-saa7115.c 2009-09-13 00:45:28.000000000 -0400 +++ wis-go7007-linux-0.9.8-6/kernel/wis-saa7115.c 2010-07-10 10:11:05.000000000 -0400 @@ -20,6 +20,7 @@ #include #include #include +#include #include "wis-i2c.h" diff -u -r -N wis-go7007-linux-0.9.8-5/kernel/wis-tw2804.c wis-go7007-linux-0.9.8-6/kernel/wis-tw2804.c --- wis-go7007-linux-0.9.8-5/kernel/wis-tw2804.c 2009-09-13 00:45:28.000000000 -0400 +++ wis-go7007-linux-0.9.8-6/kernel/wis-tw2804.c 2010-07-10 10:11:37.000000000 -0400 @@ -20,6 +20,7 @@ #include #include #include +#include #include "wis-i2c.h" diff -u -r -N wis-go7007-linux-0.9.8-5/kernel/wis-tw9903.c wis-go7007-linux-0.9.8-6/kernel/wis-tw9903.c --- wis-go7007-linux-0.9.8-5/kernel/wis-tw9903.c 2009-09-13 00:45:28.000000000 -0400 +++ wis-go7007-linux-0.9.8-6/kernel/wis-tw9903.c 2010-07-10 10:11:21.000000000 -0400 @@ -20,6 +20,7 @@ #include #include #include +#include #include "wis-i2c.h" diff -u -r -N wis-go7007-linux-0.9.8-5/udev/go7007_firmware_load.in wis-go7007-linux-0.9.8-6/udev/go7007_firmware_load.in --- wis-go7007-linux-0.9.8-5/udev/go7007_firmware_load.in 2009-09-13 00:45:28.000000000 -0400 +++ wis-go7007-linux-0.9.8-6/udev/go7007_firmware_load.in 2010-07-10 13:36:27.000000000 -0400 @@ -15,12 +15,6 @@ exit 1 fi -# fxload needs usbfs -if [ ! -d "/proc/bus/usb" ] || [ ! "$(ls /proc/bus/usb)" ]; then - echo "ERROR: Make sure usbfs|usbdevfs is mounted on /proc/bus/usb" - exit 1 -fi - # get the bus number bus=`echo $device | cut -d " " -f 2` # get the device number @@ -29,13 +23,27 @@ type=`echo $device | cut -d " " -f 6 | tr A-Z a-z` # match the type with it's firmware -[ $type == "093b:a002" ] && hex="@FIRMWARE_DIR@/ezusb/hpi_PX-M402U.hex" -[ $type == "093b:a004" ] && hex="@FIRMWARE_DIR@/ezusb/hpi_PX-TV402U.hex" -[ $type == "0eb1:6666" ] && hex="@FIRMWARE_DIR@/ezusb/hpi_LR192.hex" -[ $type == "0eb1:6668" ] && hex="@FIRMWARE_DIR@/ezusb/hpi_StarTrek.hex" +case "$type" in + "093b:a002") + hex="@FIRMWARE_DIR@/ezusb/hpi_PX-M402U.hex" + ;; + "093b:a004") + hex="@FIRMWARE_DIR@/ezusb/hpi_PX-TV402U.hex" + ;; + "0eb1:6666") + hex="@FIRMWARE_DIR@/ezusb/hpi_LR192.hex" + ;; + "0eb1:6668") + hex="@FIRMWARE_DIR@/ezusb/hpi_StarTrek.hex" + ;; + *) + echo "Device vendor id $type does not have available firmware" + ;; +esac +echo "Firmware file = $hex" -if @FXLOAD@ -t fx2 -I $hex -D /proc/bus/usb/"$bus"/"$device_num"; then +if @FXLOAD@ -t fx2 -I $hex -D /dev/bus/usb/"$bus"/"$device_num"; then echo 'Firmware loaded successfully!' else echo 'ERROR: Firmware not loaded :-('