1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-24 04:33:24 +00:00

Commit of fixes that make this buildable once again after Rev. 1.82 of

src/sys/dev/usb/usb_port.h hacked off some deprecated compatibilty macros.

A number of manually designed device printf statements were replaced with
the appropriate calls to device_printf(9). In addition, did a find/replace
of other removed macros with the previous definitions from that file.

I don't have a camera so I don't know the operative status of this port
under -CURRENT yet.

PR:		ports/106794
This commit is contained in:
Coleman Kane 2006-12-16 05:50:15 +00:00
parent 88eb9509df
commit e50e48ff32
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=179898
4 changed files with 222 additions and 0 deletions

View File

@ -7,6 +7,7 @@
PORTNAME= pwcbsd
PORTVERSION= 1.3.1
PORTREVISION= 1
CATEGORIES= multimedia sysutils
MASTER_SITES= http://raaf.atspace.org/ \
${MASTER_SITE_LOCAL}

View File

@ -0,0 +1,14 @@
--- pwc-ctrl.c Thu Jun 8 20:28:32 2006
+++ pwc-ctrl.c Fri Dec 15 14:37:57 2006
@@ -434,8 +434,9 @@
if (ret == -ENOENT)
Info("Video mode %s@%d fps is only supported with the decompressor module (pwcx).\n", size2name[size], frames);
else {
- printf("%s: Failed to set video mode to %s@%d fps; return code = %d\n",
- USBDEVNAME(pdev->sc_dev),size2name[size], frames, -ret);
+ device_printf(pdev->sc_dev,
+ "Failed to set video mode to %s@%d fps; return code = %d\n",
+ size2name[size], frames, -ret);
}
return ret;
}

View File

@ -0,0 +1,196 @@
--- pwc.c Sun Sep 24 06:58:43 2006
+++ pwc.c Fri Dec 15 14:37:13 2006
@@ -149,8 +149,9 @@
info = pwc_lookup(uaa->vendor, uaa->product);
if(info == NULL) {
- printf("%s: attach error vendor/product mismatch (vendor=0x%x product=0x%x)\n",
- USBDEVNAME(sc->sc_dev),uaa->vendor,uaa->product);
+ device_printf(sc->sc_dev,
+ "attach error vendor/product mismatch (vendor=0x%x product=0x%x)\n",
+ uaa->vendor,uaa->product);
USB_ATTACH_ERROR_RETURN;
}
@@ -159,7 +160,7 @@
err = usbd_device2interface_handle(uaa->device,0,&sc->sc_iface);
if(err) {
- printf("%s: failed to get interface handle\n",USBDEVNAME(sc->sc_dev));
+ device_printf(sc->sc_dev, "failed to get interface handle\n");
USB_ATTACH_ERROR_RETURN;
}
@@ -192,7 +193,7 @@
}
}
- mtx_init(&sc->ptrlock,USBDEVNAME(sc->sc_dev),NULL,MTX_DEF);
+ mtx_init(&sc->ptrlock,device_get_name(sc->sc_dev),NULL,MTX_DEF);
tmpstr = "video";
resource_string_value("pwc",device_get_unit(self),"devname",&tmpstr);
@@ -256,7 +257,7 @@
resource_int_value("pwc",device_get_unit(self),"pad",&sc->pwc_pad);
pwc_construct(sc);
- printf("%s: %s USB webcam\n",USBDEVNAME(sc->sc_dev),sc->name);
+ device_printf(sc->sc_dev, "%s USB webcam\n", sc->name);
if(pwc_get_cmos_sensor(sc, &i) >= 0) {
@@ -274,7 +275,8 @@
default: tmpstr = "unknown type of sensor"; break;
}
- printf("%s: This camera is equipped with a %s (%d)\n",USBDEVNAME(sc->sc_dev),tmpstr, i);
+ device_printf(sc->sc_dev, "This camera is equipped with a %s (%d)\n",
+ tmpstr, i);
}
pwc_set_leds(sc, 0, 0);
@@ -308,7 +310,7 @@
sc->state &= ~PWC_POLL;
selwakeuppri(&sc->rsel,PZERO);
}
- printf("%s: Disconnected while webcam is in use!\n",USBDEVNAME(sc->sc_dev));
+ device_printf(sc->sc_dev, "Disconnected while webcam is in use!\n");
}
if(sc->sc_dev_t != NULL)
@@ -345,7 +347,8 @@
if (sc->power_save) {
err = pwc_camera_power(sc, 1);
if (err < 0)
- printf("%s: Failed to restore power to the camera! (%d)\n", USBDEVNAME(sc->sc_dev),-err);
+ device_printf(sc->sc_dev,
+ "Failed to restore power to the camera! (%d)\n", -err);
}
pwc_set_leds(sc, sc->led_on, sc->led_off);
@@ -354,7 +357,8 @@
/* Allocate frame buffer structure */
sc->fbuf = malloc(sc->pwc_fbufs * sizeof(struct pwc_frame_buf), M_USBDEV, M_WAITOK);
if (sc->fbuf == NULL) {
- printf("%s: Failed to allocate frame buffer structure.\n",USBDEVNAME(sc->sc_dev));
+ device_printf(sc->sc_dev,
+ "Failed to allocate frame buffer structure.\n");
goto bad;
}
memset(sc->fbuf, 0, sc->pwc_fbufs * sizeof(struct pwc_frame_buf));
@@ -364,7 +368,7 @@
sc->fbuf[i].data = malloc(PWC_FRAME_SIZE,M_USBDEV,M_WAITOK);
if (sc->fbuf[i].data == NULL) {
- printf("%s: Failed to allocate frame buffer\n", USBDEVNAME(sc->sc_dev));
+ device_printf(sc->sc_dev, "Failed to allocate frame buffer\n");
goto bad;
}
memset(sc->fbuf[i].data, 128, PWC_FRAME_SIZE);
@@ -376,7 +380,7 @@
sc->decompress_data = malloc(sizeof(struct pwc_dec23_private), M_USBDEV, M_WAITOK);/* Timon & Kiara */
if(sc->decompress_data == NULL) {
- printf("%s: Failed to allocate decompress table.\n",USBDEVNAME(sc->sc_dev));
+ device_printf(sc->sc_dev, "Failed to allocate decompress table.\n");
goto bad;
}
@@ -384,7 +388,7 @@
if(sc->image_data == NULL) {
sc->image_data = malloc(sc->pwc_mbufs * round_page(sc->len_per_image), M_USBDEV, M_WAITOK);
if(sc->image_data == NULL) {
- printf("%s: Failed to allocate image buffers\n",USBDEVNAME(sc->sc_dev));
+ device_printf(sc->sc_dev, "Failed to allocate image buffers\n");
goto bad;
}
}
@@ -404,13 +408,13 @@
sc->sbuf[i].xfer = usbd_alloc_xfer(sc->udev);
if(sc->sbuf[i].xfer == NULL) {
- printf("%s: Failed to allocate transfer\n",USBDEVNAME(sc->sc_dev));
+ device_printf(sc->sc_dev, "Failed to allocate transfer\n");
goto bad;
}
sc->sbuf[i].data = usbd_alloc_buffer(sc->sbuf[i].xfer, ISO_BUFFER_SIZE);
if(sc->sbuf[i].data == NULL) {
- printf("%s: Failed to allocate transferbuffer\n",USBDEVNAME(sc->sc_dev));
+ device_printf(sc->sc_dev, "Failed to allocate transferbuffer\n");
goto bad;
}
}
@@ -466,8 +470,9 @@
programs)
*/
if(sc->vframe_count > 20 && sc->stats) {
- printf("%s: %d frames received, dumped %d frames, %d frames with errors.\n"
- ,USBDEVNAME(sc->sc_dev),sc->vframe_count, sc->vframes_dumped, sc->vframes_error);
+ device_printf(sc->sc_dev,
+ "%d frames received, dumped %d frames, %d frames with errors.\n",
+ sc->vframe_count, sc->vframes_dumped, sc->vframes_error);
}
if(sc->type == 645 || sc->type == 646)
@@ -491,7 +496,7 @@
if(sc->power_save) {
if(pwc_camera_power(sc, 0) < 0)
- printf("%s: Failed to power down the camera\n", USBDEVNAME(sc->sc_dev));
+ device_printf(sc->sc_dev, "Failed to power down the camera\n");
}
}
@@ -662,13 +667,15 @@
err = usbd_set_interface(sc->sc_iface,sc->valternate);
if(err != USBD_NORMAL_COMPLETION) {
- printf("%s: Failed to set alternate interface to: %d (%d)\n",USBDEVNAME(sc->sc_dev),sc->valternate,err);
+ device_printf(sc->sc_dev,
+ "Failed to set alternate interface to: %d (%d)\n",
+ sc->valternate,err);
return -err;
}
err = usbd_endpoint_count(sc->sc_iface, &nendpt);
if(err != USBD_NORMAL_COMPLETION) {
- printf("%s: Failed to get endpoint count (%d)\n",USBDEVNAME(sc->sc_dev),err);
+ device_printf(sc->sc_dev, "Failed to get endpoint count (%d)\n",err);
return -err;
}
for (i = 0; i < nendpt; i++) {
@@ -677,20 +684,20 @@
break;
}
if(i == nendpt) {
- printf("%s: Failed to find videoendpoint\n",USBDEVNAME(sc->sc_dev));
+ device_printf(sc->sc_dev, "Failed to find videoendpoint\n");
return -EINVAL;
}
sc->vmax_packet_size = UGETW(edesc->wMaxPacketSize);
if(sc->vmax_packet_size < 0 || sc->vmax_packet_size > ISO_MAX_FRAME_SIZE) {
- printf("%s: Invalid packetsize (%d) for endpoint %d\n",USBDEVNAME(sc->sc_dev),
+ device_printf(sc->sc_dev, "Invalid packetsize (%d) for endpoint %d\n",
sc->vmax_packet_size,edesc->bEndpointAddress);
return -EINVAL;
}
err = usbd_open_pipe(sc->sc_iface,edesc->bEndpointAddress, 0, &sc->sc_videopipe);
if(err != USBD_NORMAL_COMPLETION) {
- printf("%s: Failed to open videopipe (%d)\n",USBDEVNAME(sc->sc_dev),err);
+ device_printf(sc->sc_dev, "Failed to open videopipe (%d)\n", err);
return -err;
}
@@ -771,7 +778,8 @@
if (++sc->visoc_errors > MAX_ISOC_ERRORS) {
if(sc->error_status != EIO)
- printf("%s: Too many ISOC errors, bailing out.\n",USBDEVNAME(sc->sc_dev));
+ device_printf(sc->sc_dev,
+ "Too many ISOC errors, bailing out.\n");
sc->error_status = EIO;
awake = 1;

View File

@ -0,0 +1,11 @@
--- pwc.h Thu Jun 8 20:27:39 2006
+++ pwc.h Fri Dec 15 14:29:52 2006
@@ -133,7 +133,7 @@
struct pwc_softc
{
- USBBASEDEVICE sc_dev;
+ device_t sc_dev;
usbd_device_handle udev;
usbd_interface_handle sc_iface;
usbd_pipe_handle sc_videopipe;