Re: [fobbit-developer] 3 Linux driver patches
Brought to you by:
johngeeaswell,
mchang
|
From: Mark L. C. <mar...@ac...> - 2003-02-16 02:24:55
|
I integrated these patches into the cvs tree and into the 0.60rc1
release candidate.
I was able to successfully compile this on a 2.4.20 kernel machine, but
can't do it on my own 2.4.18 machine due to some weirdness with the
kernel source I have (RH 7.3) ... I'll see if I can do anything about that.
In the future, if you could create patches against the cvs tree, that'd
be great.
Mark
David R Bacon wrote:
> Hello All-
>
> I have made 3 separate patches to the linux driver:
> 1/3 update urb_t to struct urb (**needed to compile**)
> 2/3 update __FUNCTION__ to __LINE__ (fixes deprecation warnings)
> 3/3 add devfs support
>
> They apply in any order against v0.56, and probably v0.57, since it is
> largely unchanged.
>
> I'm not sure the best way to include 3 patches, so I attached them.
>
> Ciao,
> Dave
>
>
>
> ------------------------------------------------------------------------
>
> diff -Naur pristine/v0.56/linux_drv/usbvb.c voipblaster/v0.56/linux_drv/usbvb.c
> --- pristine/v0.56/linux_drv/usbvb.c 2002-04-04 21:47:14.000000000 -0600
> +++ voipblaster/v0.56/linux_drv/usbvb.c 2003-02-01 18:49:30.000000000 -0600
> @@ -117,6 +117,8 @@
> struct usb_device *udev; // save off the usb device pointer
> int minor; // starting minor number for this device
>
> + devfs_handle_t devfs; // devfs device node
> +
> u_char out_buffer[VOUT_SIZE]; // voice/command output buffer for urb
> u_char inp_buffer[VINP_SIZE]; // voice/status input buffer for urb
> #ifdef BG_READ
> @@ -140,6 +142,10 @@
> struct semaphore inp_sem; // locks this structure
> };
>
> +// the global devfs handle
> +extern devfs_handle_t usb_devfs_handle;
> +static struct file_operations vb_fops; // forward decl of fops for devfs use
> +
> // array of pointers to our devices that are currently connected
> static struct usb_vb *minor_table[MAX_DEVICES];
>
> @@ -974,6 +980,7 @@
> struct usb_vb *c_dev = NULL;
> struct usb_vb *v_dev = NULL;
> int minor;
> + char name[10];
>
> // See if the device offered us matches what we can accept
> if ((udev->descriptor.idVendor != USB_VB_VENDOR_ID ) ||
> @@ -1012,6 +1019,29 @@
> goto done;
> }
>
> + // initialize the devfs node for voice and control device and register them
> + sprintf(name, "vbc%d", c_dev->minor);
> +
> + c_dev->devfs = devfs_register(usb_devfs_handle, name,
> + DEVFS_FL_DEFAULT,
> + USB_MAJOR,
> + USB_VB_MINOR_BASE + c_dev->minor,
> + S_IFCHR | S_IRUSR | S_IWUSR |
> + S_IRGRP | S_IWGRP |
> + S_IROTH,
> + &vb_fops, NULL);
> +
> + sprintf(name, "vbv%d", v_dev->minor - (MAX_DEVICES/2));
> +
> + v_dev->devfs = devfs_register(usb_devfs_handle, name,
> + DEVFS_FL_DEFAULT,
> + USB_MAJOR,
> + USB_VB_MINOR_BASE + v_dev->minor,
> + S_IFCHR | S_IRUSR | S_IWUSR |
> + S_IRGRP | S_IWGRP |
> + S_IROTH,
> + &vb_fops, NULL);
> +
> // let the user know what node this device is now attached to
> info("USB Voip-Blaster (%d) connected, ifnum(%d)", minor, ifnum);
>
> @@ -1041,6 +1071,9 @@
>
> minor = c_dev->minor; // get before do any cleanup
>
> + // remove our control devfs node
> + devfs_unregister(c_dev->devfs);
> +
> // if the device is not opened, then we clean up right now
> if (!c_dev->open_count) {
> up (&c_dev->inp_sem);
> @@ -1059,6 +1092,9 @@
> down (&v_dev->out_sem);
> down (&v_dev->inp_sem);
>
> + // remove our voice devfs node
> + devfs_unregister(v_dev->devfs);
> +
> // if the device is not opened, then we clean up right now
> if (!v_dev->open_count)
> {
>
>
> ------------------------------------------------------------------------
>
> diff -Naur pristine/v0.56/linux_drv/usbvb.c voipblaster/v0.56/linux_drv/usbvb.c
> --- pristine/v0.56/linux_drv/usbvb.c 2002-04-04 21:47:14.000000000 -0600
> +++ voipblaster/v0.56/linux_drv/usbvb.c 2003-02-01 16:21:37.000000000 -0600
> @@ -65,12 +65,12 @@
> // Use our own dbg() macro
> #undef dbg
> #define dbg(format, arg...) if (debug) \
> - printk(KERN_DEBUG __FILE__ "," __FUNCTION__ ": " format "\n" , ## arg); \
> + printk(KERN_DEBUG __FILE__ ", %d: " format "\n" , __LINE__, ## arg); \
>
> // Use our own err() macro
> #undef err
> #define err(format, arg...) \
> - printk(KERN_ERR __FILE__ "," __FUNCTION__ ": " format "\n" , ## arg); \
> + printk(KERN_ERR __FILE__ ", %d : " format "\n" , __LINE__, ## arg); \
>
> // Version Information
> #define DRIVER_VERSION "v0.20"
> @@ -553,7 +553,7 @@
> // usb_vb_debug_data
> //
> static inline void
> -usb_vb_debug_data (const char *function, int size, const unsigned char *data)
> +usb_vb_debug_data (int lineno, int size, const unsigned char *data)
> {
> int i;
>
> @@ -562,8 +562,8 @@
> return;
> }
>
> - printk (KERN_DEBUG __FILE__": %s - length = %d, data = ",
> - function, size);
> + printk (KERN_DEBUG __FILE__": line %d - length = %d, data = ",
> + lineno, size);
> for (i = 0; i < size; ++i)
> {
> printk ("%.2x ", data[i]);
> @@ -668,11 +668,11 @@
> dev = (struct usb_vb *)file->private_data;
> if (dev == NULL)
> {
> - dbg (__FUNCTION__ " - object is NULL");
> + dbg ("%d - object is NULL", __LINE__);
> return -ENODEV;
> }
>
> - dbg(__FUNCTION__ " - minor %d", dev->minor);
> + dbg("%d - minor %d", __LINE__, dev->minor);
>
> // lock our minor table
> down (&minor_table_mutex);
> @@ -683,7 +683,7 @@
>
> if (dev->open_count <= 0)
> {
> - dbg (__FUNCTION__ " - device not opened");
> + dbg ("%d - device not opened", __LINE__);
> retval = -ENODEV;
> goto exit_not_opened;
> }
> @@ -710,7 +710,7 @@
>
> if (dev->udev == NULL)
> {
> - dbg (__FUNCTION__ " - device unplugged");
> + dbg ("%d - device unplugged", __LINE__);
> // the device was unplugged before the file was released
> // so held off rest of 'vb_disconnect' till now
> up (&dev->inp_sem);
> @@ -864,7 +864,7 @@
> goto exit;
> }
>
> - usb_vb_debug_data (__FUNCTION__, write_count, dev->out_buffer);
> + usb_vb_debug_data (__LINE__, write_count, dev->out_buffer);
>
> // send the data to the device
> retval = vb_bulk_msg (dev->udev,
>
>
> ------------------------------------------------------------------------
>
> diff -Naur pristine/v0.56/linux_drv/usbvb.c voipblaster/v0.56/linux_drv/usbvb.c
> --- pristine/v0.56/linux_drv/usbvb.c 2002-04-04 21:47:14.000000000 -0600
> +++ voipblaster/v0.56/linux_drv/usbvb.c 2003-01-31 21:52:44.000000000 -0600
> @@ -126,7 +126,7 @@
> int rdr_status; // interface to read system call
> wait_queue_head_t rdr_wqh ; // Processes waiting
> wait_queue_head_t rdr_pwait ; // Processes waiting
> - urb_t *have_urb ;
> + struct urb *have_urb ;
> #endif
>
> int out_size; // max size for output pipe
> @@ -160,7 +160,7 @@
> #define VB_WRITE_TIMEOUT (0)
>
> static void
> -vb_blocking_completion(urb_t *urb)
> +vb_blocking_completion(struct urb *urb)
> {
> api_wrapper_data *awd = (api_wrapper_data *)urb->context;
>
> @@ -185,7 +185,7 @@
> DECLARE_WAIT_QUEUE_HEAD(wqh);
> api_wrapper_data awd;
> int status, was_sig;
> - urb_t *urb;
> + struct urb *urb;
>
> if (len < 0)
> {
> @@ -275,7 +275,7 @@
> #define VB_WRITE_TIMEOUT (HZ*10)
>
> static void
> -vb_blocking_completion(urb_t *urb)
> +vb_blocking_completion(struct urb *urb)
> {
> struct usb_api_data *awd = (struct usb_api_data *)urb->context;
>
> @@ -291,7 +291,7 @@
> DECLARE_WAITQUEUE(wait, current);
> struct usb_api_data awd;
> int status, was_sig;
> - urb_t *urb;
> + struct urb *urb;
>
> if (len < 0)
> {
> @@ -404,7 +404,7 @@
>
> // gets called when read-urb completes
> static void
> -vb_read_restart(urb_t *urb)
> +vb_read_restart(struct urb *urb)
> {
> int status;
> int next_head;
> @@ -512,7 +512,7 @@
> vb_read_start(struct usb_vb *dev)
> {
> int status;
> - urb_t *urb;
> + struct urb *urb;
>
> dbg("dev(%d) entry", dev->minor);
>
|