> Am Samstag 18 April 2009 08:48:22 schrieb Peter Holik: >> >> +static inline int get_ethernet_addr(struct usbnet *dev) >> >> +{ >> >> + int tmp, i; >> >> + unsigned char buf [13]; >> >> + >> >> + tmp = usb_string(dev->udev, 3, buf, sizeof buf); >> >> + if (tmp != 12) { >> >> + devdbg(dev, "bad MAC string fetch, %d\n", tmp); >> >> + if (tmp >= 0) >> >> + tmp = -EINVAL; >> >> + return tmp; >> >> + } >> >> + for (i = tmp = 0; i < 6; i++, tmp += 2) >> >> + dev->net->dev_addr [i] = >> >> + (nibble(buf [tmp]) << 4) + nibble(buf [tmp + 1]); >> >> + return 0; >> >> +} >> > >> > Same here. >> >> Disagree, because i've taken "nibble" and "get_ethernet_addr" from >> cdc_ether.c to have the same code (the version of Jan was different). > > In this case you should look at having cdc-ether export these functions. Sorry explained it the wrong way. I've taken get_ethernet_addr as codebase from cdc_ether.c, but had to modify it a little bit. cdc_ether.c: static inline int get_ethernet_addr(struct usbnet *dev, struct usb_cdc_ether_desc *e) { int tmp, i; unsigned char buf [13]; tmp = usb_string(dev->udev, e->iMACAddress, buf, sizeof buf); if (tmp != 12) { dev_dbg(&dev->udev->dev, "bad MAC string %d fetch, %d\n", e->iMACAddress, tmp); if (tmp >= 0) tmp = -EINVAL; return tmp; } for (i = tmp = 0; i < 6; i++, tmp += 2) dev->net->dev_addr [i] = (nibble(buf [tmp]) << 4) + nibble(buf [tmp + 1]); return 0; } int51x1.c: static inline int get_ethernet_addr(struct usbnet *dev) { int tmp, i; unsigned char buf [13]; tmp = usb_string(dev->udev, 3, buf, sizeof buf); if (tmp != 12) { devdbg(dev, "bad MAC string fetch, %d\n", tmp); if (tmp >= 0) tmp = -EINVAL; return tmp; } for (i = tmp = 0; i < 6; i++, tmp += 2) dev->net->dev_addr [i] = (nibble(buf [tmp]) << 4) + nibble(buf [tmp + 1]); return 0; } The idea was to use a code, that's known to work. cu Peter -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html